Gettext PO
GNU Gettext is a widely used i18n system implemented in most programming languages and frameworks. It is most commonly used for internationalizing PHP, Python, C, C#, etc.
Gettext offers different resource file formats to externalize your segments. The most common human/machine-readable file format is Portable Object (.po
), which Lingohub supports.
The import of POT (Portable Object Templates) files is also supported. Every imported POT file will be handled as a source language update. This means the msgid
attributes will be used as segment keys and values of the segment's source language text.
Format
- The value of the PO attribute
msgid
will be used as the segment key. - The value of
msgstr
will be used as the text for the segment. - If
msgctxt
is given, it will be used as part of the segment key. E.g.:<msgctxt>/<msgid>
- The segment's title is created using the
msgctxt + msgid
has to be unique in every file. - Examples of placeholders are:
“%s”, “%10s”, “%d”, “%3.4d”
- Lingohub can handle plurals defined using the
msgid_plural
- One can specify a header for a PO file containing metadata.
You do not need to specify a header to work with Lingohub. We ensure that the header will be exported as it was imported. - In the PO file header, you can specify a charset:
Content-Type: text/plain; charset=UTF-8\n
.
Please make sure that this indication is correct. Lingohub will try to fix the wrong character declarations. - A comment line starts with
#
. Lingohub will parse these comments and assign them as descriptions to the next segment. - Lingohub will not try to interpret special comments like references or flags but will leave the values unaltered.
- The comment placed before the header will be imported and exported untouched.
Examples
Additional example files can be accessed here. Django
# header comment
msgid ""
msgstr ""
"Project-Id-Version: LingoHub 1.6.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-05-05 19:22+0200\n"
"PO-Revision-Date: 2013-04-29 10:16+0100\n"
"Last-Translator: Translator <[email protected]>\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"
msgid "mood"
msgid_plural "%d moods"
msgstr[0] "%d mood"
msgstr[1] "%d moods"
# nplurals is defined for 0 and 1. One should be imported even if it is not present
msgid "hand"
msgid_plural "%d hands"
msgstr[0] "%d hand"
# LingoHub translation title will be "email/To"
msgctxt "email"
msgid "To"
msgstr "To"
# multiline values
msgid "slogan"
msgstr ""
"Continuous Translation "
"Made Simple"
Used by
References
Updated 17 days ago