Jump to: navigation, search

Translating Gramps

No change in size, 00:08, 17 January 2013
{{languages|Translating GRAMPS}}
Tips for translators of the GRAMPS Gramps program.
The page [[Coding_for_translation|coding for translation]] may also be of interest to translators.
# If possible, try the translation before sending
Translating GRAMPS Gramps into a new language means translating English strings used in the GRAMPS Gramps interface. To put it shortly, this amounts to
# obtaining the gramps.pot file with the strings to be translated,
# translating the strings in the template, and
===Obtaining gramps.pot===
* Download <code>gramps.pot</code> from GRAMPS Gramps SVN repository, see [[Brief_introduction_to_SVN| the introduction to SVN]].
* Look for <code>gramps.pot</code> in the directory <code>gramps{{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>.
* 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 [ GTtranslator] (GNOME, windows), [ KBabel] (KDE), [ Lokalize] (KDE, windows), Emacs po-mode, [ pootling] (GNU/Linux, windows), [ 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 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.
As an extension to standard gettext, strings in GRAMPS Gramps can have a context prefix. This prefix should '''not''' be translated, and just be deleted in the translation. More info and an example [[#Translation context|further down]].
As a special context, you will see the manual context, eg :
===Updating your translation===
If you have submitted a translation, it may well be that after some weeks/months, new strings are added to GRAMPSGramps, implying you need to update your translation file.
Assuming you have obtained originally the GRAMPS Gramps source tree as explained in [[Brief introduction to SVN]]. Now:* Update your gramps tree from SVN. This can be done by executing the command <pre>svn up</pre> from the root GRAMPS Gramps svn directory. This will download an updated <code>gramps.pot</code> file.
* Use your outdated translation to translate the strings that did not change:<pre>msgmerge lang.po gramps.pot -o newlang.po</pre> or <pre>msgmerge --no-wrap lang.po gramps.pot -o newlang.po</pre> where <code>lang</code> is your language code. The <code>--no-wrap</code> option will prevent changes due to automatic word wrapping, use it if your previous po file was constructed like that. The <code>--no-wrap</code> options allows for more readable SVN diffs.
* Check fuzzy messages and translate all untranslated messages in <code>newlang.po</code>. When you are sure everything is right, rename <code>newlang.po</code> as <code>lang.po</code> and check it into SVN as you did with the original file.
This should install your translations to ''/usr/share/locale/{lang}/LC_MESSAGES/'', with {lang} being your language. You could of course copy your files manually to that dir with the name.
Make sure you only install from within the po directory, or you will install the development version of GRAMPSGramps, which is not supported and for testing only!
==== Running trunk with your translation ====
===== $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 Gramps without needing superuser privileges. Bear in mind the GRAMPS Gramps i18n process goes something like this when you use trunk:
* when you type <code>python build</code> in the source tree root (/home/user/trunk e.g.) all the trunk/po/*.po files are compiled into trunk/build/mo/{lang}/*.mo files.
* when you type <code>python install</code> inside the /home/user/trunk/po directory, these .mo files are copied to {prefix}/share/locale/{lang}/LC_MESSAGES as files.
But you can change the place where GRAMPS Gramps looks for these files by altering the environment variable $GRAMPSI18N. So you could also for instance do something like this and avoid the <code>python setup install</code> step: (if you are using csh or tcsh the syntax would be a little different)
[[email protected] /home/user/trunk]$ mkdir -p po/en_GB/LC_MESSAGES
==Translating wiki manual==
To have the link working in GRAMPSGramps, you need to have or edit the file to contain your language.
On line 30 of that file, you see:
*Every 'manual|...' entry in the gramp.pot file refers to a section in the manual, so make sure to use good section headings so this does not change too much over time.
Note that reports/tools link to a section in the page with the same name as the report name in GRAMPSGramps.
*You should be able to edit directly on wiki or using tools like [ txt2po] or [ po4a]. Also previous gettext file for the manual and [ Translation Memory] may help you to upgrade deprecated/old gettext files.
==Translating addon plugins==
* See [[Addons_development#Get_translators_to_translate_your_addon_into_multiple_languages|3rd-party addon for GRAMPSGramps]].

Navigation menu