Viewing 1 post (of 1 total)
  • #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, which is where this diagram was found:

    GetText flow 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:

    1. The software (kiwitrees) includes translatable text in US English, in the getText format, like WT_I18N::translate(‘Statistics’).
    2. External software is used to read and store all those text elements in a single xxx.pot (Portable Object Template).
    3. That is then converted into a series of human-readable text files like xx.po (Portable Object), one for each language.
    4. The external software then converts those to a machine-readable format, the (Machine Object) files that kiwitrees will read.

    Each time kiwitrees needs to display a translatable text it looks for the appropriate language 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 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:

    1. I have included all the xx.po files on my GitHub kiwitrees site, at 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.
    2. Open that file in any decent text editor (I recommend NotePad++) that can save it encoded as “utf8 without bom” (this is essential)
    3. 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.
    4. 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 ) , but you do not need to do that unless you want to use it on your own system immediately.
    5. Send me the revised .po file (and .mo if you create one) either by email, or as an attachment to a post here.
    6. I will add the updated .po file to GitHub for others to access, and post the new .mo file for download on this site.
    7. 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.
    My personal kiwitrees site is
Viewing 1 post (of 1 total)
  • The topic ‘How do languages work?’ is closed to new replies.