- This topic has 0 replies, 1 voice, and was last updated 10 years ago by
kiwi.
-
22nd November 2013 at 2:55 pm #1758
I thought it might be helpful to provide a brief explanation of how basic language translations work in kiwitrees. It is the same as in webtrees, but I don’t think it has ever been well explained. This explanation does not include the more complex variable texts (gender differences, singular/plural, etc; nor does it cover “custom translations”.
The system used is called “getText”. It is very well described at en.wikipedia.org/wiki/Gettext, which is where this diagram was found:
Typical gettext workflow. The de.po instance on the left shows that no string translation was found, so the original string is passed through.
What that shows is the four-stage process required for all translations:
- The software (kiwitrees) includes translatable text in US English, in the getText format, like WT_I18N::translate(‘Statistics’).
- External software is used to read and store all those text elements in a single xxx.pot (Portable Object Template).
- That is then converted into a series of human-readable text files like xx.po (Portable Object), one for each language.
- The external software then converts those to a machine-readable format, the xx.mo (Machine Object) files that kiwitrees will read.
Each time kiwitrees needs to display a translatable text it looks for the appropriate language xx.mo file. If it finds one it uses that language version instead of the coded text. If there is no file for that language, or no translation in the file, it defaults to the original coded text.
In a typical xx.po file each translatable string looks like this:
'#: statistics.php:38 statistics.php:50 library/WT/MenuBar.php:113 #: modules_v3/gedcom_stats/module.php:34 modules_v3/html/module.php:163 msgid "Statistics" msgstr "Statistiques"'
The two lines starting with “#” are comments showing where in the system the text exists.
”msgid” is the original US English coded text
“msgstr” is the translated version.
If you find that a text is not translated for your language, or is translated incorrectly, then the .po file for your language needs to be changed and a new xx.mo file created (external software required) and distributed to our users.
The method I want to use, at least for now, to achieve that is as follows:
- I have included all the xx.po files on my GitHub kiwitrees site, at https://github.com/kiwi3685/kiwitrees1.4.4.0 You can download any of them directly from there by following these steps:
- Click on the file name (e.g. fr.po) to open it.
- Click on the “Raw” button near top-right of the file to display the raw code of the file on a new tab.
- Right-click and “save as” to your desktop as a .po file.
- Open that file in any decent text editor (I recommend NotePad++) that can save it encoded as “utf8 without bom” (this is essential)
- Add or modify the “msgstr” part of the text you want to translate or change in your own language. DO NOT change the “msgid” part. Save that revised file.
- If you want you can now compile that file into a .mo version – if you have and can use some form of gettext software (I recommend Poedit from http://www.poedit.net ) , but you do not need to do that unless you want to use it on your own system immediately.
- Send me the revised .po file (and .mo if you create one) either by email, or as an attachment to a post here.
- I will add the updated .po file to GitHub for others to access, and post the new .mo file for download on this site.
- Periodically I will post an updated complete set of .mo files in the Downloads area of this site if there are changes between each release of kiwitrees.
Nigel
My personal kiwitrees site is www.our-families.info
- The topic ‘How do languages work?’ is closed to new replies.