Translating¶
Crown tools use GNU gettext for handling translations. Source strings are marked
in code with _() or N_() and translations live in tools/po.
Files¶
tools/po/POTFILESSource files scanned by
xgettext. Add a file here when it contains translatable strings.tools/po/crown-editor.potTemplate generated from the source files. Do not edit translations here.
tools/po/LINGUASList of languages to build and ship.
tools/po/<lang>.poTranslation for
<lang>.
Creating a New Translation¶
Create the
.pofile from the current template. For example, for Italian:msginit --input=tools/po/crown-editor.pot --locale=it --output-file=tools/po/it.po
Add the language to
tools/po/LINGUAS.Translate
msgstrvalues intools/po/it.po. Do not changemsgidvalues.
Updating an Existing Translation¶
Regenerate the template and merge it into the language file:
make -C tools/po pot
msgmerge --update tools/po/it.po tools/po/crown-editor.pot
Translate new empty or fuzzy entries, then remove any remaining fuzzy markers.
Checking a Translation¶
Validate a .po file with:
msgfmt -c --statistics -o build/linux64/bin/po/it/LC_MESSAGES/crown-editor.mo tools/po/it.po
The output should not report fuzzy or untranslated messages before committing a completed translation.
Build and Test¶
The tools build compiles every language listed in tools/po/LINGUAS into the
build directory:
make crown-editor-linux-debug64
Run the editor in a language with:
env -u LC_ALL LANGUAGE=it build/linux64/bin/crown-editor
LC_ALL overrides other locale variables, so unset it while testing. Using
LANG=it_IT.UTF-8 also works when that locale is installed on the system
LANGUAGE=it is usually easier for quick gettext tests.
Translation Rules¶
Keep the source capitalization style. If the English text is title case, use
title case in the translation too, for example New Project... becomes
Nuovo Progetto....