GetText is the
GNU internationalization and localization library.
It is commonly used for writing multilingual web-applications in
PHP or
Python, but it's also used during C/C++ development.
Amanuens let you easily and efficiently localize your applications that use GetText-style files as string resources. GetText files usually have a
.po or
.pot extension.
Amanuens Prerequisites
Amanuens works with or without
.pot files (often called templates). To make things easier, we suggest you to avoid using
.pot files as they require a special folder structure.
You can generate
.po files starting from your application's source code using the
xgettext command-line tool, as described at
this page. This tool will scan the entire source code, replacing all strings with a function call that will dynamically load the correct text based on the current user's locale. All localizable text is then saved in a
.po file, ready for being used with Amanuens.
// Example for a C application
printf("%d results found.", count);
// After running xgettext
printf(_("%d results found."), count);
The
.po file contains several blocks, one for each string, all with a stucture similar to this:
msgid "%d results found."
msgstr "%d risultati trovati."
Amanuens supports multiple
.po files for the same application as long as they have different names. There are two main layout supported by Amanuens.
In all cases, Amanuens automatically detects the following language codes formats:
xx,
xx-YY or
xx_YY.
Language Code in Folder Paths (without .pot)
WebApp/
resources/
en/
strings.po
currencies.po
it_IT/
strings.po
currencies.po
DesktopClient/
resources/
en/
strings.po
it_IT/
strings.po
Language Code in File Names (without .pot)
WebApp/
resources/
strings.en.po
currencies.en.po
strings.it_IT.po
currencies.it_IT.po
DesktopClient/
resources/
strings.en.po
strings.it_IT.po
Using .pot Files
When using
.pot files, each folder must have one single
.pot file, which are used as masters, and one or more
.po files, containing translated resources.
WebApp/
resource/
strings.pot
strings_it.po
strings_fr.po
DesktopClient/
resources/
strings.pot
strings_it.po
strings_fr.po
Language codes can be separated from the main file name with a dot, a dash or an underscore, thus all the following formats are allowed:
- strings.en.po
- strings-en.po
- strings_en.po
- strings.en-US.po
- strings-en-US.po
- strings_en-US.po
- strings.en_US.po
- strings-en_US.po
- strings_en_US.po
Managing Updates
When you modify or add strings in the source code, you just have to run the
xgettext tool again, and Amanuens will be able to identify the new and updated strings.
Getting Started with Amanuens
Make sure all of your existing
.po files are committed in your source code repository (Amanuens will generate missing files automatically). To start translating your application you can continue reading on how to
configure projects in Amanuens.