Difference between revisions of "Translation environment4"

From Gramps
Jump to: navigation, search
(How it works)
(alternate ways)
Line 26: Line 26:
 
** fuzzy flag (-f) will list fuzzy messages on '''lang.po file'''.
 
** fuzzy flag (-f) will list fuzzy messages on '''lang.po file'''.
  
==== alternate ways ====
+
==== Alternate ways ====
 
* One way: intltool (perl), gettext
 
* One way: intltool (perl), gettext
  

Revision as of 05:35, 8 January 2017

Gramps-notes.png
Current

This page describes the current translation environment used for Gramps 4.0.x to Gramps master.

How it works

  • Recommended way: python, ElementTree[1] and xgettext[2]
python update_po.py -h
python update_po.py --help
python update_po.py [options]

For generating a new template:

python update_po.py -p
  • parser generates a new template and also provides some common features.
    • test flag (-t) will test if 'python' and 'gettext' are properly installed.
  • extract options are everything around extraction for message strings.
    • xml flag (-x) will extract messages from xml based, ini and desktop files.
    • glade flag (-g) will extract messages from glade file format only.
    • clean flag (-c) will remove created files.
    • pot flag (-p) will create a new catalog.
  • update options are everything around update for translation file(s).
    • merge flag (-m) will merge lang.po file(s) with last catalog.
    • check flag (-k) will check lang.po file(s), will try to compile and will also use check_po script.
  • translation options provide some information about one translation file.
    • untranslate flag (-u) will list untranslated messages on lang.po file.
    • fuzzy flag (-f) will list fuzzy messages on lang.po file.

Alternate ways

  • One way: intltool (perl), gettext
intltool-update -p

which should be considered as incomplete, see differences between tools.

  • xgettext and shell
genpot.sh

Files and directory

Like with previous environment, we need to list files with translation strings for retrieving messages and generating a 'po/gramps.pot' file. Process is now only using gettext and python.

  • gettext, 'POTFILES.in' and 'POTFILES.skip' files

If you want a script to take your translatable strings into account, you must add your source file path in the file : po/POTFILES.in. For this report example, you should add:

...
gramps/plugins/leak.py
gramps/plugins/mediamanager.py
gramps/plugins/myreport.py                # <------
gramps/plugins/narrativeweb.py
gramps/plugins/patchnames.py
...

We can still check if some references are missing via:

$ intltool-update -m

Translating man pages

You can also translate the man pages (short for manual page a form of software documentation on Linux systems) into your own language.

For the development version (master branch) you can find the required starting files under the directory /data/man.

You need at least docutils package.

Some of the files you will find in the data/man directory are:

  • update_man.py
  • en.rst
  • gramps.1

First off all you must make a directory for your language under data/man.

cd data/man

and on Linux run the following command mkdir xx

where xx is your two letter language code (fr for French, sv for Swedish, etc.)

Next step is to copy the en.rst from data/man to your new directory and rename it to your language code eg: fr.rst for French.

Then translate all relevant strings in the data/man/xx/xx.rst file.

Edit the file data/man/update_man.py and search for following line LANGUAGES = ['sv', 'nl', 'pl', 'cs', 'pt_BR', 'fr', 'xx'] where 'xx' is your new language. Save the file.

Run data/man/update_man.py: $ python update_man.py -m

All changes must be committed and pushed to your server (You should use Git. See the introduction to Git.):

git commit -am "Add man page for xx"
git push

To see the result of your work, do:$ man xx/gramps.1

See also