Gettext PO

GNU Gettext is a widely used internationalization system implemented across many programming languages and frameworks, including PHP, Python, C, and C#. LingoHub supports the Portable Object (.po) format, which is the standard human-readable format for Gettext.

LingoHub also supports Portable Object Template (.pot) files. Every imported .pot file serves as a source language update, where the msgid attributes define both the segment keys and the source language values.

Format

  • LingoHub uses the msgid attribute as the segment key.
  • The msgstr attribute provides the translation content for the segment.
  • If a msgctxt attribute is present, LingoHub includes it in the segment key (e.g., msgctxt/msgid).
  • The combination of msgctxt and msgid must be unique within each file.
  • Supported placeholders include standard printf formatters such as %s, %d, and %3.4d.
  • LingoHub supports plural forms defined via the msgid_plural attribute.
  • LingoHub preserves the PO file header and its metadata during export.
  • LingoHub respects the charset defined in the header (e.g., Content-Type: text/plain; charset=UTF-8).
  • Comments beginning with # are parsed and assigned as descriptions to the subsequent segment.
  • LingoHub preserves special comments (such as references or flags) and header comments without modification.

LingoHints can be included in a comment:

# <lh>{"status": "DRAFT","qc": {"min": "3","max": "20"},"labels": ["q3-2024"],"not_translatable": false}</lh>
msgctxt "email"
msgid "To"
msgstr "To"

Example

Additional example files are available on GitHub.

# 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"

# plural form for the singular item
msgid "hand"
msgid_plural "%d hands"
msgstr[0] "%d hand"

# LingoHub translation title: "email/To"
msgctxt "email"
msgid "To"
msgstr "To"

# Multi-line values
msgid "slogan"
msgstr "" 
"Continuous Translation "
"Made Simple"

Used by


References