wiki:TranslatingNicotinePlus

Translating Nicotine Plus

There are several tools needed to create or modify a translation for Nicotine.

Required

  • xgettext
  • msgmerge
  • msgfmt

Optional

  • poedit

Translation Files

View the Translation files (Source .po and Binary .mo)

Python source to POT conversion tool

  • To create the .pot file (template)
    • Run the following command from the nicotine+ directory:
      cd nicotine+/
      cp nicotine nicotine.py
      xgettext -k_ -kN_ -o languages/nicotine.pot *.py */*.py */*/*.py
      rm nicotine.py
      


    • Or run the tr_gen script
      cd nicotine+/
      ./tr_gen
      


To create a new language

Create a subdirectory under nicotine+/languages/ for your translation. Copy the 'nicotine.pot' to that subdirectory and rename it to 'nicotine.po'. Edit this file with  poedit or the editor of your choice.

POT to PO conversion tool

  • Import the nicotine.pot
    • To update all the language .po files with the latest strings, run following command from the nicotine+/languages directory:
      cd nicotine+/languages/
      find ./ -iname *.po -exec  msgmerge -U {} nicotine.pot \;
      
      Then, each nicotine.po will need to be updated with the new translations.
    • To update just the translation you wish to work on with the latest strings, run the following command:
      cd nicotine+/languages/
      msgmerge -U languages/??/nicotine.po nicotine.pot
      
      Replace the ?? with the language you're working on.

Modify the PO file

  • Edit the nicotine.po file in the language directory.
    • Edit the nicotine.po with a text editor

    • Install  poedit, and edit the nicotine.po with it.

    • Use some other app to edit the nicotine.po file

Convert to PO to the useful MO format

  • Create the binary .mo file from the .po plain-text source.
    cd nicotine+/languages/??/
    msgfmt nicotine.po -o nicotine.mo
    



Install Translation

  • After nicotine has been installed, the new .mo files will be in /usr/share/locale/$LANGUAGE/LC_MESSAGES/

For testing, you can copy them there, yourself (if you have proper permissions).

  • To install
    python setup.py --prefix=/usr install
    

Don't Translate These Phrases

Translating these will break the GUI in various horrible ways.

  • "ImageLabel"

Credit for Translations

TranslatorsOfNicotine

Running Nicotine Plus with a specific translation

For Nicotine to know you want a certain translation, your locale needs to be set to that language.

English

LC_ALL=en_US nicotine

French

LC_ALL=fr_FR nicotine

German

LC_ALL=de_DE nicotine

Dutch

LC_ALL=nl_NL nicotine

Danish

LC_ALL=dk_DK nicotine

Italian

LC_ALL=it_IT nicotine

Spanish

LC_ALL=es_ES nicotine

Polish

LC_ALL=pl_PL nicotine

Swedish

LC_ALL=sv_SE nicotine

Hungarian

LC_ALL=hu_HU nicotine

Slovakian

LC_ALL=sk_SK nicotine

Portuguese Brazilian

LC_ALL=pt_BR nicotine

Lithuanian

LC_ALL=lt_LT nicotine

Euskare (Basque)

LC_ALL=eu nicotine

Finnish

LC_ALL=fi_FI nicotine

Go back to DevelopingNicotinePlus