Changes

Jump to: navigation, search

Translating Gramps

1,084 bytes added, 06:25, 16 November 2012
m
Installing your translation
Tips for translators of the GRAMPS program.
 
The page [[Coding_for_translation|coding for translation]] may also be of interest to translators.
 
[[Category:Translators/Categories]][[Category:Developers/General]]
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
* ''Project-Id-Version'' : this is the name and version of the package. Fill it in if it has not already been filled in by xgettext.
===Obtaining gramps.pot===
* Download <code>gramps.pot</code> from GRAMPS SVN repository, see [[Brief_introduction_to_SVN| the introduction to SVN]].
* Look for <code>gramps.pot</code> in the directory <code>gramps32gramps{{stable_branch}}/po</code> or if you looking for the trunk version look for <code>gramps.pot</code> in the directory <code>trunk/po</code>.
===Translating messages===
* Copy <code>gramps.pot</code> to the file named <code>lang.po</code>, according to the language you are translating into (<code>fr.po</code> for French, <code>ru.po</code> for Russian, etc.)
* Use [http://gtranslator.sourceforge.net GTtranslator] (GNOME, windows), [http://i18n.kde.org/tools/ KBabel] (KDE), [http://userbase.kde.org/Lokalize Lokalize] (KDE, windows), Emacs po-mode, [http://translate.sourceforge.net/wiki/pootling/index pootling] (GNU/Linux, windows), [http://www.poedit.net/ poedit] (GNU/Linux, OSX, windows), or any similar tool designed for translating <code>.po</code> files. If you do not like any of these tools, you can use any text editor to translate messages. If using vim, properly setting the "langmap" option will significantly speed up your work.
* Even though GRAMPS uses UNICODE (UTF-8) for its character set, you may use your native character set for your translation. Just make sure you specify the character set you are using in the <code>Content-Type</code> line in the <code>.po</code> file. GRAMPS will handle the conversion to UNICODE.
* If there are non ASCII characters in the original English string, try to preserve them by copying them, if applicable.
===Context===
As a special context, you will see the manual context, eg :
'manual|Editing_Dates'
these strings should only be translated if a wiki manual is available in your language. , eg in Dutch : 'Datums_aanpassen'  The string refers to a section, eg [[Gramps_3.0_Wiki_Manual_3_Wiki_Manual_-_Entering_and_Editing_Data:_Detailed_Detailed_-_part_1#Editing_Dates Editing_dates |Editing_Dates]] in Dutch becomes [[Gramps_3.0_Wiki_Manual_3_Wiki_Manual_-_Entering_and_Editing_Data:_Detailed_Detailed_-_part_1/nlde#Datums_aanpassenDaten_bearbeiten|Datums_aanpassen]].
===Testing your <code>.po</code> file===
In the directory <code>gramps32gramps{{stable_branch}}/po</code> or the <code>trunk/po</code> run the command: <pre>make</pre> If there are errors in your po file, this will fail and give you an error message. You should correct these errors. If you have trouble understanding the error, try to run the next test, which might give a more verbose output.
====check_po====
In the directory <code>gramps32gramps{{stable_branch}}/po</code> or the <code>trunk/po</code> run the command: <pre>  ./check_po --skip-fuzzy lang.po</pre> or <pre> python check_po --skip-fuzzy lang.po > lang</pre> where lang is your language code. This will give you errors in your translation, information on badly translated phrases, ... the output could resemble something like this..
File: nl.po
====statistics====
In the directory <code>gramps32gramps{{stable_branch}}/po</code> or the <code>trunk/po</code> run the command: <pre>msgfmt --statistics lang.po</pre> or <pre>msgfmt.exe --statistics lang.po</pre> where lang is your language code. This should not throw an error.
Basically this gives the same info in a condensed format: 3533 translated messages, 125 fuzzy translations, 12 untranslated messages.
===Updating your translation===
If you have submitted a translation, changes are it may well be that after some weeks/months, new strings are added to GRAMPS, implying you need to update your translation file.
Assuming you have obtained originally the GRAMPS source tree as explained in [[Brief introduction to SVN]]. Now:
make update-po
in the <code>po</code> directory. This assumes that you have already succesfully configured the source. Note, this command ignores <code>--no-wrap</code> option, so not practical for SVN diffs.
 
{{man warn|Environment change|For trunk, see [[Translation_environment4|new environment]].}}
===Testing your update===
You can test your update easily with the above mentioned '''check_po''' file. If you downloaded this file, just do:
<pre> python check_po --skip-fuzzy newlang.po</pre>. If everything is ok, the output will be something like this:
File: newlang.po
Template total: 3075
===Installing your translation===
 
{{man warn|Environment change|For trunk, see [[Translation_environment4|new environment]].}}
You want to use the new translation immediately, and systemwide?
make --prefix=/usr install #as root !
This should install your translations to <code>''/usr/share/locale/xx{lang}/LC_MESSAGES/gramps.mo</code>'', with xx {lang} being your language. You could of course copy your files manually to that dir with the gramps.mo name.
Make sure you only install from within the po directory, or you will install the development version of GRAMPS, which is not supported and for testing only!
==== Running trunk with your translation ====
The current GRAMPS trunk as of February 2009 by default looks for the i18n data are often under <code>/usr/local''../share/locale</code>'' according to the default prefix. So you can use:
./autogen.shSo you can use: make cd popython setup.py build make python setup.py install #as root !
This will install the .mo files under /usr/local''../share/locale/xx/LC_MESSAGES'', since according to the default prefix is /usr/localset.
or
python setup.py build python setup.py install --root=/home/joe/autogen.sh gramps-trunk --prefix="/home/...joe/gramps4" make make install --enable-packager-mode #as simple user !
This will install Gramps and translations under your ''/home/...'' directory.
===== $GRAMPSI18N (for your locale) =====
Actually you don't even need to install the files in order to test them. This is useful because you can develop GRAMPS without needing superuser privileges. Bear in mind the GRAMPS i18n proccess process goes something like this when you use trunk as of February 2009:
* when you type <code>makepython build</code> in the source tree root (/home/user/trunk e.g.) all the trunk/po/*.po files are compiled into trunk/pobuild/mo/{lang}/*.gmo mo files.* when you type <code>make python install</code> inside the /home/user/trunk/po directory, these .gmo mo files are copied to /usr/local{prefix}/share/locale/xx{lang}/LC_MESSAGES as gramps.mo files.
But you can change the place where GRAMPS looks for these files by altering the environment variable $GRAMPSI18N. So you could also for intance instance do something like this and avoid the <code>make python setup install</code> step: (if you are using csh or tcsh the syntax would be a little different)
[user@localhost /home/user/trunk]$ mkdir -p po/en_GB/LC_MESSAGES [user@localhost /home/user/trunk]$ cp po/en_GB.gmo po/en_GB/LC_MESSAGES/gramps.mo [user@localhost /home/user/trunk]$ cd srcgramps [user@localhost /home/user/trunk/src]$ GRAMPSI18N=$PWD/../po LANG=en_GB.UTF-8 python gramps.py
===== gramps.sh =====
msgid "%d second"
msgstr_plural msgid_plural "%d seconds"
msgstr [0] "%d 秒"
msgid "%d hour"
msgstr_plural msgid_plural "%d hours"
msgstr [0] "%d hour"
msgstr [1] "%d hours"
msgid "%d second"
msgstr_plural msgid_plural "%d seconds"
msgstr [0] "%d sekunda"
msgstr [1] "%d sekundy"
msgfmt -c filename.po
===Translating mnemonicskeys(Keyboard Shortcut keys)===Mnemonics are accelerator keys (also known as Keyboard Shortcut keys) you find in labels, accessible by pressing the {{man key press|ALT }} key together with the mnemonic. You see then in the translated text with a low line, eg '_Help' is shown as 'Help' with a line under the H, and can be put to focus/selected by pressing {{man key press|ALT+|h}}.
It is nice if mnemonics on a screen are unique, but it is not required. If you use twice the same mnemonic, the user must press repeatedly the accelerator to switch between the different entries. However, note the following rule:
*"If duplication of access keys in a window is unavoidable, you should still refrain from duplicating the access keys for any of these buttons that appear in the same window: {{man button|OK}}, {{man button|Cancel}}, {{man button|Close}}, {{man button|Apply }} or {{man button|Help}}."
So you should check in your language what the mnemonic key is for those buttons, and avoid using the same in translated text
Note that reports/tools link to a section in the page with the same name as the report name in GRAMPS.
*You should be able to edit directly on wiki or using tools like [http://translate.sourceforge.net/wiki/toolkit/txt2po txt2po] or [http://po4a.alioth.debian.org/ po4a]. Also previous gettext file for the manual and [http://en.wikipedia.org/wiki/Translation_memory Translation Memory] may help you to upgrade deprecated/old gettext files.
==Language specific pages==
Check out the pages which cover some aspects of translation into a specific language, such as the glossary.
*[[Translation into Finnish|Finnish]]
*[[Translation into French|French (Français)]]
*[[Translation into Russian|Russian]]
==Translating addon plugins==
* See [[Addons_DevelopmentAddons_development#Get_translators_to_translate_your_addon_into_multiple_languages|3rd-party addon for GRAMPS 3.2]].

Navigation menu