-
Notifications
You must be signed in to change notification settings - Fork 279
PO Extensions
Poedit uses several custom header fields in the PO Header. They are only added when necessary to implement some functionality and use the usual X-Poedit-*
naming.
The following are de-facto standard fields that are not specific to Poedit, but are written and recognized by it:
X-Generator: Poedit 1.7.4
Name and version of the application that created the file.
X-Source-Language: de
Specify the source language of the PO file, if it’s not English. Allowed valued are the same as for the standard Language
header. Usually not necessary because Poedit tries to autodetect the language. (Since 1.8.10)
X-Poedit-SourceCharset: UTF-8
Charset of the source code if not ASCII. Same charsets as in Content-Type
are accepted.
X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;
Semicolon-separated list of gettext functions to extract. Each element of the list uses the same syntax as arguments to xgettext's -k
flag.
(Since 1.8.10) As a special case, consistently with xgettext’s -k
flag, an empty value may be present in this list. This translates to passing -k
without argument to xgettext, meaning “don’t use default keywords for given language”. For example, X-Poedit-KeywordsList: ;_;
will only find _()
calls, but not the default gettext()
ones.
X-Poedit-Basepath: ..
Path to the toplevel directory of the sources to extract translations from. The value should be a Unix-style path relative to the location of the PO(T) file.
X-Poedit-SearchPath-0: src
X-Poedit-SearchPath-1: include
Numbered X-Poedit-SearchPath-
n values are paths under the "basepath" that should be scanned for translations and must be directories. The paths should again be Unix paths, relative to X-Poedit-Basepath
.
X-Poedit-SearchPathExcluded-0: include/private
X-Poedit-SearchPathExcluded-1: *.js
Numbered in the same way as X-Poedit-SearchPath
, X-Poedit-SearchPathExcluded
removes directories or files that are included by X-Poedit-SearchPath
from being scanned for translations. The value may be either a relative Unix path to a directory or a file or a wildcard. (The header is supported since 1.6, wildcards support was added in 1.7.)
X-Poedit-Flags-xgettext: --language=C++ --add-comments=translators:
(Since 2.0) Additional flags passed to xgettext
when invoked during translatable strings extraction.
To facilitate extraction of WordPress plugin/theme header fields, Poedit stores a X-Poedit-WPHeader
header pointing to the extension’s main file (i.e. style.css
or <pluginname>.php
), as a path relative to the base path.
X-Poedit-WPHeader: jetpack.php
Old versions of Poedit used X-Poedit-Language
and X-Poedit-Country
fields to specify the language (variant), with English names used for values. This is no longer in use and was fully replaced by the standard Language
field.
Old versions of Poedit used X-Poedit-Bookmarks
field to provide in-file bookmarks as comma-separated list of 10 bookmarked positions in the file (0-based indexes of entries in the file or -1 for unset). This is no longer in use.