Changes

Jump to: navigation, search

Translating Gramps

814 bytes added, 07:37, 1 April 2017
m
Updating your translation
===Getting started===
# Always save your translations in UTF-8 encoding '''without [https://en.wikipedia.org/wiki/Byte-order_mark BOM]''' ([http://achilles-keep-moving.blogspot.de/2011/10/msgfmt-fatal-error-with-utf-8-with-bom.html take care with ''NotePad''])
# Don't overwrite the English strings, your translation should be below the original string
# Take heed on special characters. You must have the same number of and types as the original string.
===Obtaining gramps.pot===
* Download <code>gramps.pot</code> from Gramps Git repository, see [[Brief_introduction_to_Git| the introduction to Git]].
You can also download files by browsing via [https://github.com/gramps-project/gramps GitHub web interface].
* Look for <code>gramps.pot</code> in the '''po''' directory.
===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://translatevirtaal.sourceforgetranslatehouse.net/wiki/pootling/index pootlingorg Virtaal] (GNU/Linux, Mac, 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 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.
As a special context, you will see the manual context, eg :
'manual|Editing_Dates'
these strings should only be translated if a '''wiki user manual ''' is available in your language, eg in Dutch :
'Datums_aanpassen'
The string refers to a section, eg [[Gramps_3Gramps_4.3_Wiki_Manual_1_Wiki_Manual_-_Entering_and_Editing_Data:_Detailed_-_part_1#Editing_dates |Editing_Dates]] in Dutch becomes [[Gramps_3Gramps_4.3_Wiki_Manual_1_Wiki_Manual_-_Entering_and_Editing_Data:_Detailed_-_part_1/de#Daten_bearbeiten|Datums_aanpassen]].
===Testing your <code>.po</code> file===
 
{{man warn|Environment change|For Gramps 4.0, {{stable_branch}} and master, see [[Translation_environment4|new environment]].}}
 
In the <code>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.
===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. However, try to [[Translating_Gramps#Save_as_.mo_file|check syntax]] before any commit. ===Send your contribution=== Check it into Git if you obtained the permission to do so, or email it . The following configuration option simplifies pushing a branch back to [[Contact|Brian or Benny]] otherwisethe server: $ git config --global push.default upstream Otherwise you can fork gramps repository with a Github account and pull a merge requestSee: {{Code Browser}}
===Updating your translation===
Assuming you have obtained originally the Gramps source tree as explained in [[Brief introduction to Git]]. Now:
* Update your Gramps tree from Git. This can be done by executing the command <pre>git pull--rebase</pre> from the root Gramps 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 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 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 master branch translations onto an earlier branch, do this on the eariler earlier branch (assuming gramps.pot is updated):
<pre>msgmerge -C lang.po master-lang.po gramps.pot -o newlang.po</pre>. Then resolve the fuzzies as usual.
* Create new <code>gramps.pot</code> template from the source code files
cd po
make gramps.pot/genpot.sh or cd po intltool-update python update_po.py -psee [[Talk:Translation_environment4|differences between tools]].
* Updates each <code>po</code> file in the source tree
It may be an overkill for you, but if you feel like using it, you can run:
cd po
make updatepython update_po -po m all in the <code>po</code> directory. This assumes that you have already succesfully successfully configured the source. Note, this command ignores <code>--no-wrap</code> option, so not practical for Git diffs.
{{man warn|Environment change|For Gramps 4.0 , {{stable_branch}} and master, see [[Translation_environment4|new environment]].}}
===Testing your update===
===Installing your translation===
{{man warn|Environment change|For Gramps 4.0 , {{stable_branch}} and master, see [[Translation_environment4|new environment]].}}
You want to use the new translation immediately, and systemwide?
===== gramps.sh =====
On a gramps launcher (copy from ''<code>{prefix}/bin/gramps</code>'') you can set :
export GRAMPSDIR=/...
export GRAMPSI18N=/...
So you should check in your language what the mnemonic key is for those buttons, and avoid using the same in translated text
'''{{man warn|Warning''': some |Some fonts family will not properly display mnemonics on "g", "j", "p", "q" or "y" as these print the letter over the line under it making it very hard to distinguish the small line. Please avoid to use mnemonics key bindings on these letters. Also try to avoid i and l, as people have difficulty distinguishing between those.}}
Capital letters are no problem though, underlining eg G will work just fine as the letter does not write over the line.
==Translating man pages==
{{man warn|Environment change|For gramps 4.0 , {{stable_branch}} and master, see [[Translation_environment4#Translating_man_pages|new environment]].}}
You can also translated the man pages into your own language.
First off all you must make a directory for your language under data/man.
<code>
cd data/man
</code>
<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]].
git push
You should see no errors when you run the  <code> ./configure</code><br/> <code>make</code> <br/>scripts.
{{man warn|Install|This last step must be done only in the data/man/xx directory. If not, your normal gramps installation will be overwritten. And this step must be done as superuser(su)}}
<code>
sudo make install
</code>
This will put the gramps.1.gz file into /usr/local/share/man/xx/man1 directory. You could also use a prefix. Then you do:<code>
sudo make --prefix=/usr/share install
</code>
<code>sudo make install</code> This will put the gramps.1.gz file into /usr/local/share/man/xx/man1 directory. You could also use a prefix. Then you do: <code>sudo make --prefix=/usr/share install</code> To see the result of your work, do: <code> man -L xx gramps</code>
==Translating wiki manual==
}
*Every '<code>manual|...</code>' entry in the <code>gramp.pot </code> 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 Gramps.

Navigation menu