Difference between revisions of "Translation environment4"

From Gramps
Jump to: navigation, search
m (Files and directory)
m
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
This page describes the next translation environment.
 
This page describes the next translation environment.
 +
 +
See [[GEPS_026:_Replace_'make'_for_Gramps_build|Replace make]]. ''completed'' (testing stage)
  
 
Could be used for Gramps '''4.0.x'''.
 
Could be used for Gramps '''4.0.x'''.
  
 
==How it works==
 
==How it works==
 +
 +
* One way: intltool (perl), gettext
 +
 +
intltool-update -p
 +
 +
which should be considered as incomplete, see [[Talk:Translation_environment4|differences between tools]].
 +
 +
* xgettext and shell
 +
 +
genpot.sh
 +
 +
* Other way: python, ElementTree[http://docs.python.org/library/xml.etree.elementtree.html] and xgettext[http://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/xgettext-Invocation.html]
  
 
  python update_po.py -h
 
  python update_po.py -h
 
  python update_po.py --help
 
  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.
 
* ''parser'' generates a new template and also provides some common features.
 
** test flag (-t) will test if 'python' and 'gettext' are properly installed.
 
** test flag (-t) will test if 'python' and 'gettext' are properly installed.
 
* ''extract'' options are everything around extraction for message strings.
 
* ''extract'' options are everything around extraction for message strings.
** xml flag (-x) will extract messages from xml based file formats.
+
** xml flag (-x) will extract messages from xml based, ini and desktop files.
 
** glade flag (-g) will extract messages from glade file format only.
 
** glade flag (-g) will extract messages from glade file format only.
 
** clean flag (-c) will remove created files.
 
** clean flag (-c) will remove created files.
 
** pot flag (-p) will create a new catalog.
 
** pot flag (-p) will create a new catalog.
* ''update'' options are everything around update for translation files.
+
* ''update'' options are everything around update for translation file(s).
** merge flag (-m) will merge lang.po files with last catalog.
+
** merge flag (-m) will merge '''lang.po file(s)''' with last catalog.
** check flag (-k) will check lang.po files, will try to compile and will also use ''check_po'' script.
+
** check flag (-k) will check '''lang.po file(s)''', will try to compile and will also use ''check_po'' script.
* ''translation'' options are some informations about translation files.
+
* ''translation'' options are some informations about one translation file.
** untranslate flag (-u) will list untranslated messages.
+
** untranslate flag (-u) will list untranslated messages on '''lang.po file'''.
** fuzzy flag (-f) will list fuzzy messages.
+
** fuzzy flag (-f) will list fuzzy messages on '''lang.po file'''.
  
 
===Files and directory===
 
===Files and directory===
  
Like with [[Translation_environment22#Files_and_directory|previous environment]], we need to list files with translation strings for retrieving messages and generating a 'po/gramps.pot' file.
+
Like with [[Translation_environment22#Files_and_directory|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''.
  
* xgettext and 'po/gramps' file
+
* 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 : <code>po/gramps</code>. For this report example, you should add:
+
If you want a script to take your translatable strings into account, you must add your source file path in the file : <code>po/POTFILES.in</code>. For this report example, you should add:
  
 
  ...
 
  ...
  ../gramps/plugins/leak.py
+
  gramps/plugins/leak.py
  ../gramps/plugins/mediamanager.py
+
  gramps/plugins/mediamanager.py
  ../gramps/plugins/myreport.py                # <------
+
  gramps/plugins/myreport.py                # <------
  ../gramps/plugins/narrativeweb.py
+
  gramps/plugins/narrativeweb.py
  ../gramps/plugins/patchnames.py
+
  gramps/plugins/patchnames.py
 
  ...
 
  ...
 +
 +
==Translating man pages==
 +
 +
You can also translated the man pages 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 [http://docutils.sourceforge.net/ docutils package].
 +
 +
You will find the files
 +
*update_man.py
 +
*en.rst
 +
*gramps.1
 +
 +
First off all you must make a directory for your language under data/man.
 +
<code>
 +
  cd data/man
 +
</code>
 +
 +
and do <code>
 +
  mkdir xx
 +
</code>
 +
 +
where xx is your languagecode (fr for French, sv for Swedish, etc.) You should use Git. See [[Brief_introduction_to_Git| the introduction to Git]].
 +
 +
Next step is to copy the en.rst from data/man to your new directory and rename it to your langage code.
 +
 +
Translate all relevant strings in the data/man/xx/xx.rst file.
 +
 +
Edit the file data/man/update_man.py by adding your lang
 +
 +
Run data/man/update_man.py:
 +
<code>
 +
$ python update_man.py -m
 +
</code>
 +
 +
All changes must be committed and pushed to the server:
 +
git commit -am "Add man page for xx"
 +
git push
 +
 +
To see the result of your work, do:<code>
 +
  $ man xx/gramps.1
 +
</code>
  
 
[[Category:Translators/Categories]]
 
[[Category:Translators/Categories]]
 
[[Category:Developers/General]]
 
[[Category:Developers/General]]

Revision as of 16:59, 6 February 2014

This page describes the next translation environment.

See Replace make. completed (testing stage)

Could be used for Gramps 4.0.x.

How it works

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

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

  • xgettext and shell
genpot.sh
  • Other 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 are some informations 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.

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
...

Translating man pages

You can also translated the man pages 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.

You will find the files

  • 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 do

  mkdir xx

where xx is your languagecode (fr for French, sv for Swedish, etc.) You should use Git. See the introduction to Git.

Next step is to copy the en.rst from data/man to your new directory and rename it to your langage code.

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

Edit the file data/man/update_man.py by adding your lang

Run data/man/update_man.py:

$ python update_man.py -m

All changes must be committed and pushed to the server:

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

To see the result of your work, do:

  $ man xx/gramps.1