Introduction
A .pot file is the template of a GNU gettext
translation: the list of every message in a program, with no translations. The letters
stand for Portable Object Template. xgettext makes it by reading the
program’s source code; each language’s
.po catalogue is made
from it.
The manual says that xgettext writes the template as
domainname.po, which the maintainer renames to
domainname.pot for historical reasons. A translator who starts a new
language copies package.pot to LANG.po, by hand or with
msginit. To bring an existing translation up to date with a newer
template, msgmerge --previous merges the two: new messages arrive empty,
changed ones are marked fuzzy with the earlier text kept in
#| lines, and messages no longer in the template become
obsolete.
The extension .pot is also used for PowerPoint templates; see the
list at the end of this page.
A file dropped on any page opens in the explorer, which reads a template with the
same reader as a .po file and shows the same table.
Structure
A template has exactly the syntax of a PO file: the same entries and strings, the same comments and flags and the same header entry. What sets it apart is its content:
- Every
msgstris empty, and in a plural entry so is everymsgstr[N]. There is nothing translated yet. - The header entry holds placeholders for the translator to fill in:
SOME DESCRIPTIVE TITLE,YEARandFIRST AUTHOR <EMAIL@ADDRESS>, YEARin its comments, and values such asPACKAGE VERSION,FULL NAME <EMAIL@ADDRESS>,LANGUAGE <LL@li.org>andcharset=CHARSET. A template has no translator, language or revision date yet. - The header carries
Project-Id-Version,Report-Msgid-Bugs-ToandPOT-Creation-Date, whichxgettextfills in. - Every entry usually has references (
#:) to its place in the source, extracted comments (#.) from the programmer, and a format flag such asc-formatwherexgettextrecognised a format string.
#. Title of the main window
#: src/main.c:57
msgid "Untitled"
msgstr ""
#: src/files.c:90
#, c-format
msgid "One file"
msgid_plural "%d files"
msgstr[0] ""
msgstr[1] ""
Because the encoding in a template is the placeholder CHARSET, a template
with characters outside ASCII cannot be read as a known encoding until the placeholder
is replaced; the tools treat the file as ASCII or as UTF-8, depending on how they are
run.
Not described
Known, not yet covered
- Reference: how
xgettextchooses what to extract from each programming language, which strings it flags and how it orders the entries. The manual describes it per language; this page does not. - Viewer: a template is shown with the same view as a catalogue, without a view of what has still to be translated beyond the empty translation column.
Variants
- gettext PO message catalogue – the text catalogue a translator edits
- gettext POT template – the template a catalogue is made from, with every translation empty
- gettext MO binary catalogue – the compiled catalogue that programs load
Also used for
- PowerPoint 97–2003 presentation – PowerPoint’s binary presentation before PPTX: nested records in a compound file.
Links
Software
- Poedit – translation editor that makes a catalogue from a template (Windows, macOS, Linux)
- GNU gettext – xgettext writes templates; msginit and msgmerge make and update catalogues from them (Linux, macOS, Windows)
- Weblate – web-based translation platform that starts new languages from a template
Developers
- polib – reads and writes PO and POT files (Python)
- Babel – extracts messages into a template and updates catalogues from it (Python)
- gettext-parser – parses and writes PO files (JavaScript)
Reference
- The Format of PO Files – the GNU gettext manual’s description of the syntax that templates share
- Filling in the Header Entry – the manual on the header, the template name and the steps from template to catalogue