Open main menu

Gramps β

Changes

Howto:Change the language of reports

3,449 bytes added, 10:30, 27 January 2011
Automatically translate names and places: new sub-section
== Run the report==
Having started GRAMPS in another language, all reports you make will also be in this language. Off Of course, things you typed in yourself are not translated.
===Tips for international use===
* for notes: use the languages the people who are most interested in this section will want it in. This version enables multiple notes, so you are able to make different notes, one per language, with the possibility to use filters to determine what appears
* for descriptions: Try to use built-in description names as much as possible, as those are translated. Eg, try to avoid custom events, and use the builtin events of GRAMPS as much as possible.
 
===Automatically translate names and places===
As of the current version (3.2), GRAMPS doesn't support language tagging of alternative names --- whether for a person or a location. That is, you can add multiple alternative names, each in a different language, but still only one of them will be the primary one --- and will be the one picked up for a report. Nevertheless, when exporting to a relative not speaking your language, or when preparing a report for a part of your family having different language preferences than yourself, you need to change the primary language, but only in a temporary manner --- so that you still continue maintaining your own DB in your preferred language.
 
Luckily, the simplicity of the GRAMPS XML format allows to use a small XSL stylesheet, fed by a local translation table of the names you want translated, which you can use for this purpose. Here's how you can easily do it on Linux:
* Ensure your administrator installs the "xsltproc" package.
* Export your GRAMPS DB (without media) in the .gramps format (i.e., GZipped GRAMPS XML). Save it (let's call it Smith.gramps). Ensure you enable the required censorship on the database (such as restrict the data on living people, etc.)
* Store the translation XSL ([http://www.tarunz.org/~vassilii/pub/gramps-translate/gramps-translate.xsl gramps-translate-names.xsl]) near the Smith.gramps. Look at the XSL source for advance parameters allowing you to customize the translation.
* Create the translation dictionary ([http://www.tarunz.org/~vassilii/pub/gramps-translate/t.xml t.xml]) near it as well:
<?xml version="1.0" encoding="UTF-8"?>
<nowiki><dict xmlns="http://tarunz.org/xml/dict/0.1.0/"></nowiki>
<w>
&lt;s lang="ru">Хана&lt;/s>
&lt;s lang="ru">Ханна&lt;/s>
&lt;s lang="de">Hane&lt;/s>
&lt;s lang="en">Hannah&lt;/s>
</w>
</dict>
: Populate it with the translations for all the stems you want translated. The translation breaks down names into stems using a customizable delimiter set. This allows translation of compound names, like ''Menachem-Mendl'', using the same rules, as given for the simple names comprising the compound, i.e., ''Menachem'' and ''Mendl'' in this case.
* Run the translation, using the xsltproc command. To just use the defaults (Russian to English translation), do this:
gunzip < Smith.gramps | xsltproc gramps-translate-names.xsl - > en.Smith.gramps.xml
:See the XSL source for more advanced parameters. E.g., if you want to collect the stems missing translation into a file "missing", translate into German, and use "[LIVING]" as the censorship marker, the command line will be something like this:
gunzip < Smith.gramps | xsltproc --stringparam living '[LIVING]' --param log-missing 1 --stringparam lang-to de gramps-translate-names.xsl - > de.Smith.gramps.xml 2> missing
 
 
* Use the "missing" file obtained above to collect stems to add to the translation dictionary.
* You can use the following [http://www.tarunz.org/~vassilii/pub/gramps-translate/Makefile Makefile] stanza to facilitate your processing:
GZIP=gzip
GUNZIP=gunzip
XSLT=xsltproc
TRANSLATEXSL=gramps-translate.xsl
en.%.gramps: %.gramps
$(GUNZIP) < $< | $(XSLT) --stringparam living '[LIVING]' $(TRANSLATEXSL) - | $(GZIP) > $@
* Create a new database in gramps, and import the resulting en.Smith.gramps into it. Review the database, and now produce, using the language translated into, all the reports, export into GEDCOM, etc.
[[Category:Tutorials|Change the language of reports]]
[[Category:Documentation]]
[[Category:Translators/Categories]]
296
edits