Changes

Jump to: navigation, search

Translating Gramps

842 bytes removed, 18:05, 7 November 2013
svn to git
# obtaining the gramps.pot file with the strings to be translated,
# translating the strings in the template, and
# getting the translated file uploaded into gramps SVN the Gramps Git repository.Another avenue of translation is translating the documentation. This is a different and lengthy process and it is decribed described in our [[Translating the Gramps User manual]] page. Here we will concentrate on the interface translation only.
===Obtaining gramps.pot===
* Download <code>gramps.pot</code> from Gramps SVN Git repository, see [[Brief_introduction_to_SVNBrief_introduction_to_Git| the introduction to SVNGit]].* 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>.
===Translating messages===
===Testing your <code>.po</code> file===
In the directory <code>gramps{{stable_branch}}/po</code> or the <code>trunk/po</code> directory 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>gramps{{stable_branch}}/po</code> or the <code>trunk/po</code> directory run the command:
./check_po --skip-fuzzy lang.po
====statistics====
In the directory <code>gramps{{stable_branch}}/po</code> or the <code>trunk/po</code> directory 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.
===Formatting (compiling) <code>.po</code> file===
* Currently, [[Coding_for_translation#How_it_works|formatting (msgfmt) is performed during build time]], so you should not have to worry about it. The translated <code>.po</code> file is the product of your work. Check it into SVN Git if you obtained the permission to do so, or email it to [[Contact|Brian or Benny]] otherwise.
===Updating your translation===
If you have submitted a translation, 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 SVNGit]]. Now:* Update your gramps Gramps tree from SVNGit. This can be done by executing the command <pre>svn upgit pull</pre> from the root 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 Git 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 Git as you did with the original file.
* If command <code>msgmerge</code> is not available on your system, you have to install the <code>}gettext</code> package. For [http://wiki.wxpython.org/index.cgi/Internationalization#How_to_get_gettext_tools_for_Win32 windows users].
* To back-port translations, e.g., to merge trunk master branch translations onto an earlier branch, do this on the eariler branch (assuming gramps.pot is updated):<pre>msgmerge -C lang.po trunkmaster-lang.po gramps.pot -o newlang.po</pre>. Then resolve the fuzzies as usual.
There is also the make target that does the following:
cd po
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 Git diffs.
{{man warn|Environment change|For gramps Gramps 4.0 and trunkmaster, see [[Translation_environment4|new environment]].}}
===Testing your update===
===Installing your translation===
{{man warn|Environment change|For gramps Gramps 4.0 and trunkmaster, see [[Translation_environment4|new environment]].}}
You want to use the new translation immediately, and systemwide?
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 the master branch with your translation ====
The i18n data are often under ''../share/locale'' according to the default prefix.
python setup.py build
python setup.py install --root=/home/joe/gramps-trunk
--prefix="/home/joe/gramps4"
--enable-packager-mode #as simple user !
===== $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 process goes something like this when you use trunkthe master branch:
* when you type <code>python build</code> in the source tree root (/home/user/trunk Gramps 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 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 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/trunkGramps]$ mkdir -p po/en_GB/LC_MESSAGES [[email protected] /home/user/trunkGramps]$ cp po/en_GB.gmo po/en_GB/LC_MESSAGES/gramps.mo [[email protected] /home/user/trunkGramps]$ cd gramps [[email protected] /home/user/trunkGramps/src]$ GRAMPSI18N=$PWD/../po LANG=en_GB.UTF-8 python gramps.py
===== gramps.sh =====
==Translating man pages==
{{man warn|Environment change|For gramps 4.0 and trunkmaster, see [[Translation_environment4#Translating_man_pages|new environment]].}}
You can also translated the man pages into your own language.
For the development version (trunkmaster branch) version you can find the required starting files under the directory (/trunk)/data/man. You will find the files
*Makefile.am
*gramps.1.in
</code>
where xx is your languagecode (fr for French, sv for Swedish, etc.) You should use SVNGit. See [[Brief_introduction_to_SVNBrief_introduction_to_Git| the introduction to SVNGit]]. Then do <code> svn add xx svn commit -m "xx dir for man pages" xx</code>This will add the xx dir under svn revision control and upload the new dir.
Next step is to copy the Makefile.am and gramps.1.in from data/man to your new directory. Translate all relevant strings in the data/man/xx/gramps.1.in file. Change the file data/man/xx/Makefile.am:
*add the line mandir = @[email protected]/xx
*add data/man/xx/Makefile to the line AC_CONFIG_FILES([
Because you added new files, SVN requires that you set All changes must be committed and pushed to the correct propset for those files. Two things are to be done.server:<code> svn propset svn:mime git commit -type text/plain xx/gramps.1.in xx/Makefile.am svn propset svn:eol-type native xx/gramps.1.in "Add man page for xx/Makefile.am"</code> You could also in the config file of subversion ( HOMEDIR/.subversion/config) enable the auto-prop feature (enable-auto-props = yes) and uncomment the relevant lines in the [auto-props] section.All changes must be committed. git push
You should see no errors when you run the <code>

Navigation menu