Natural Language Support¶
BOUT++ uses GNU gettext. to
provide translations of output strings. Configuration is described in
Natural Language Support and running in Natural language support. Currently
zh_CN have been added, but it is quite
easy to add more. See
locale/README.md or below.
Marking strings for translation¶
In the code strings are wrapped with
_("hello world"). Find a string you want to replace (which
can include formatting like
%d), surround it with
_(). Then in
the locale directory:
will update the template file
BOUT_TOP/locale. The template file should not be edited, but is
used to generate language-specific files (
To update these language files see the next section.
Adding support for a new language, or improving the translations in the existing files can be done by:
Going to the
localeBOUT++ subdirectory and running:
llis the language code e.g.
make locale-de. This will create a file
locale/ll/libbout.pofile. Edit the .po file in de subdirectory (not the .pot file!), adding the translations. Each
msgidentry should have a translated
msgstrentry. If you don’t want to translate them all, just delete the ones you don’t translate. Any missing will just revert to the version in the code. If you’re adding UTF-8 characters, change the content line in the .po file to have charset=UTF-8.
make. This should output something like:
Building language: fr Building language: zh_CN Building language: zh_TW
The new language should now be available (no need to recompile BOUT++).