wiki:Documentation/HOWTO/Translations
Last modified 12 months ago Last modified on 01/11/16 12:14:44

Translating the po language files

fldigi uses GNU gettext to handle multiple languages. All the strings are automatically collected in a file that is then translated, and at run time the proper strings are loaded according to the preference of the user. These files are located in the source directory po. The master language file is po/fldigi.pot. Copy it to po/xx.po and start to edit po/xx.po with your translations (substitute your 2 letter lowercase language designation for the xx). The file contains a lot of groups like this:

#: src/dialogs/fl_digi.cxx:147 src/dialogs/fl_digi.cxx:2372
msgid "Show all modes"
msgstr "Mostra tutti i modi"

The first line is a comment telling you where in the source code this string is present. It may be multiple places like in this example, and there may be more comment lines. The msgid line contains the string in English. Do not change this. The msgstr line contains your translation.

Some editors are capable of recognizing the PO mode and helping you finding strings that have to be translated, or those that have changed in the source code and need adjustments. I use emacs for this task.

You will need to compile and recompile, and recompile again... it's a long and tedious work. It will help if you learn how to use git. I learnt it while doing the translation myself. Set up a local git repository, create a branch for yourself (so that your work is not overwritten when you sync the local copy to the remote master) and work on that one. When you have a workable file, produce a patch and send it to fldigi-devel, Dave or Stelios will merge it into the main git repository.

Step by step instructions

(this section is work in progress, apologies for incompleteness and errors)

  1. Setup your local git copy:
    $ mkdir build; cd build
    
    $ git clone git://git.code.sf.net/p/fldigi/fldigi fldigi
    
    flmsg, flrig etc can similarly be obtained
    
    $ git clone git://git.code.sf.net/p/fldigi/flmsg flmsg
    $ git clone git://git.code.sf.net/p/fldigi/flrig flrig
    
    $ cd fldigi  (or flmsg, flrig)
    
    1. Get acquainted with git if you don't know it already.
      A good read to the git user manual will help.
  2. Create a branch for your translation:
    $ git checkout -b mylanguage
    
    You can name the branch whatever name you prefer.
  3. Prepare your new translation file:
    $ cd po
    $ cp fldigi.pot xx.po
    
    Use your language code in place of xx (for example, it.po). Also edit LINGUAS and add your language code to the existing ones, all on one line, separated by a space.
  4. Commit your initial files:
    $ git add xx.po
    $ git commit -a
    
    This will be your starting point. Doing a git diff master mylanguage now should show the addition to LINGUAS and the new file xx.po.
  5. Edit xx.po.
    Having an editor capable of highlighting the syntax of the po file will be of help. I use emacs and the gettext mode (apt-get install gettext-el), which is a good help in finding strings that need translation and avoiding damage to the original strings (which must not be touched). You can do it with any editor and a bit of attention.
  6. Save and get ready to test your changes:
    $ FIXME: insert here sequence of make commands to properly generate the gmo files and install them
    
  7. Not Satisfied? GOTO 5!
    You'll get seriously bored getting all the translations done properly. When you're tired for the day, commit your changes.
    $ git commit -a
    
    This will save a history of your translation efforts in your local git repository.

submitted by: Pierfrancesco Caci, ik5pvx