PO files for use with Gettext.
File Extensions
.po
API Extension
gettext
Import
Yes
Export
Yes
Pluralization supported?
Yes
Descriptions supported?
Yes
Example
msgid ""
msgstr ""
"Language: English\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: PhraseApp (phraseapp.com)\n"
msgid "boolean_key"
msgstr "--- true\n"
msgid "empty_string_translation"
msgstr ""
# This is the amazing description for this key!
msgid "key_with_description"
msgstr "Check it out! This key has a description! (At least in some formats)"
msgid "key_with_line-break"
msgstr "This translations contains\na line-break."
msgid "nested.deeply.key"
msgstr "Wow, this key is nested even deeper."
msgid "nested.key"
msgstr "This key is nested inside a namespace."
msgid "null_translation"
msgstr ""
msgid "pluralized_key"
msgid_plural ""
msgstr[0] "Only one pluralization found."
msgstr[1] "Wow, you have %s pluralizations!"
msgid "sample_collection"
msgstr "---\n- first item\n- second item\n- third item\n"
msgid "simple_key"
msgstr "simple key, simple message, so simple.2"
#, fuzzy
msgid "unverified_key"
msgstr "I need verification, please verify me! (In some formats we also export this status)"
A typical Gettext entry looks something like this:
# description (Optional)
msgid "key-name"
msgstr "My Translation"
Gettext Header
The header of a Gettext file might contain a locale name and data for pluralization that PhraseApp will extract during import:
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: PhraseApp (phraseapp.com)\n"
Descriptions
If you provide comments in your Gettext file we will add them as key descriptions during import:
# This is my description
msgid "app_title"
msgstr "My Software Project"
Context
Gettext uses the msgctxt
notation to distinguish different contexts for the same msgid
. In PhraseApp every key name must be unique thus we will add the msgctxt
as the first part of the key name, separated by two pipe symbols (||):
msgctxt "menu"
msgid "Open"
msgstr "I'am a translation"
msgctxt "forum"
msgid "Open"
msgstr "I'am some other translation"
In order to add the msgctxt
to a new key, simply prepend it to the key name:
my_context||my_key_name
This will result in the following Gettext output:
...
msgctxt "my_context"
msgid "my_key_name"
...
Pluralization
Gettext supports plural forms for a translation:
msgid "new_messages"
msgid_plural ""
msgstr[0] "You have a new message"
msgstr[1] "You have %{count} new messages"
Fuzzy
The fuzzy
keyword is used for translators verification. Thus fuzzy
will automatically invoke the unverification process within your app. If you’re unfamiliar with verifications please have a look at the documentation on verification.
#, fuzzy
msgid "app_title"
msgstr "My Software Project"