Gettext PO File

The GNU gettext toolset helps programmers and translators at producing, updating and using translation files, mainly through PO files which are textual, editable files.

Gettext PO (Portable Object) files are used by GNU gettext.

This format behaves slightly differently from most other formats to ensure compatibility with GL Strings.

  1. IDs

    When importing a PO file, IDs will be automatically generated following this pattern:
    contextName$@MsgidHash[pluralisationType]

    Note:

    • pluralisationType is only included for plural messages.
    • $@ is used as a delimiter in generated IDs. To prevent errors, avoid including $@ in your msgid values.
    • If you change a msgid value in your application and import the PO file again, it will create a new entry on the dashboard because the msgid hash will have changed.
  2. Pluralisation

    All supported pluralisation types can be included in the gettext PO export, but some may not be present in your export file, since PO files apply special pluralisation rules for many languages.

    Example:

    • For Arabic (ar) export, all pluralisations are present in the file [zero,one,two,few,many,other].
    • For Japanese (ja) export, only one pluralisation type is present [other].

    Gettext PO uses 17 pluralisation styles. These styles conform to those from Qt TS files, most of which are documented here.

  3. Meta Attributes

    After you imported a PO file, your Project will have meta attributes called ApplangaIDContext and ApplangaIDSource and ApplangaIDPluralSource.

    These attributes should not be edited manually.

  4. Additional Metadata

    Metadata fields for attributes present in the PO file will also be created:

    • ApplangaPOExtractedComments contains comments given by the programmer, directed to the translator.
    • ApplangaPOReference contains references to the program’s source code.
    • ApplangaPOFlags contains a list of keywords that inform further tool processing.

You can either import and export your PO files manually via the dashboard, or you can automate your PO file translation process with the GL Strings Localization CLI.

Website: https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html

Specification Value
File Extension .po
CLI Format Key gettext_po
CLI Supported true
SDK Supported false
String Description Supported true
Pluralization Supported true

Example:

msgid ""
msgstr ""
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Applanga (applanga.com)\n"

msgid "empty_string_key"
msgstr ""

# Here is the description of the key
msgid "with_description_key"
msgstr "This key has a description in some file-formats."

msgid "with_line_break_key"
msgstr ""
"This key has a line break\n"
"in it."

msgid "nested_key.level_one_a.level_two"
msgstr "A deeply nested key."

msgid "nested_key.level_one_b"
msgstr "A nested key."

msgid "array_key[0]"
msgstr "first entry"

msgid "array_key[1]"
msgstr "second entry"

msgid "array_key[2]"
msgstr "third entry"

msgid "simple_key"
msgstr "Most basic translation."

msgid "plural_key"
msgid_plural ""
msgstr[0] "Plural key one"
msgstr[1] "Plural key other"