Gettext PO Localization

GNU Gettext is a widely used i18n system. For a majority of programming languages and frameworks you will find a Gettext implementation. Most commonly it is 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). LingoHub supports this file type.

The import POT (Portable Object Templates) files is supported as well. Every imported POT file will be handled as source language update. This means the “msgid” attributes will be used as translation title and as value of the source language text of the segment.

Format

  • The value of the PO attribute “msgid” will be used as translation title.
  • 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 translation title. Eg.: “<msgctxt>/<msgid>”
  • As mentioned in our Resource Files documentation, the title that is created using msgctxt + msgid has to be unique in every file.
  • Examples for placeholders are: “%s”, “%10s”, “%d”, “%3.4d”
  • LingoHub is able to handle plurals defined using “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. On the other hand LingoHub will try to fix wrong charset declarations.
  • A comment line starts with “#”. LingoHub will parse these comments and will assign it as description to the next segment.
  • LingoHub will not try to interpret any special comments like references or flags, but will leave the values unaltered.
  • The comment placed before the header will be imported and exported untouched.

Example

Additional example files can be accessed here.

# 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 <translator@lingohub.com>\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"

References

 



Was this Helpful ?   yes     no Chat with us