Загрузите файл для перевода
Мы рассчитаем стоимость и свяжемся с Вами
Загрузите файл (не более 10 МБ)
the CLOUDGN help center

Parsing rules
* .po, * .pot files

Rules for parsing * .po, * .pot files for an application localization project
Source files
Files Assignment:
a .po file is a translation file for an application, with the .po extension and with a special structure containing: information about the language, the translator, original dialogs and their translations.
a .pot file is a translation template. This is a copy of the .po file (when no strings are translated). All translation lines are derived from project files, but nothing has yet been translated.
Example the source .po file:
msgid ""
msgstr ""
"Project-Id-Version: app-name\n"
"POT-Creation-Date: 2014-07-21 17:20+0000\n"
"PO-Revision-Date: 2018-09-14 12:30\n"
"Last-Translator: employer <employer@company.domain>\n"
"Language-Team: Английский\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: new.com\n"
"Generated-By: Yii EMessage\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X- Poedit-Project: app-name\n"
"X- Poedit-Language: en\n"
"X- Poedit-File: /HelpDesk/app.pot\n"
"Language: en_US\n"

msgid "Сохранить"
msgstr "Save"

msgctxt "app"
msgid "Мы получили сообщение:"
msgstr "We received the message:"

msgid "%s day"
msgid_plural "%s days"
msgstr[0] "%s день"
msgstr[1] "%s дня"
msgstr[2] "%s дней"
msgstr[3] "%s дней"
The original dialogs begin with msgid, followed by the msgstr "translation text" lines. Information about the language and translator is at the beginning of the * .po file. If there is no translation for the dialogue, msgstr remains empty. Lines beginning with # are comments.

Main settings:
  • Project-Id-Version — name and version of the project.
  • Last-Translator — translator's name and email.
  • Language-Team — translation team name.
  • Language — language code that contains the translation in the file.
Auxiliary parameters:
  • Plural-Forms — plural form.
  • X-Poedit-KeywordsList — the names and parameters of the functions, the lines from which will be taken for translation.
  • X-Poedit-Basepath — main folder. Files in it and in its subfolders will be scanned for the presence of translation lines. Two points (..) indicate that the main folder is one level above the current file folder.
  • X-Poedit-SearchPath-0 — folders (relative to the main) in which you want to view files. A point (.) means you need to view all files.
  • X-Poedit-SearchPathExcluded-0 — folder (relative to the main), where you do not need to view files.
We consider the main keys with the text in the examples below:
msgctxt "app"
msgid "Мы получили сообщение:"
msgstr "We received the message:"

msgid "%s day"
msgid_plural "%s days"
msgstr[0] "%s день"
msgstr[1] "%s дня"
msgstr[2] "%s дней"
msgstr[3] "%s дней"
Keys Description:


a.Purpose: context.
b.Example: app.
c.Explanation: context specified in string msgctxt. The context may not be present.


a.Purpose: source string or key.
b.Example: We received a message :.
c.Explanation: source line is specified in string msgid.


a.Purpose: translation.
b.Example: We received the message:.
c.Explanation: the translation is indicated in the string msgstr.


a.Purpose: source string in the plural.
b.Example: %s days.
c.Explanation: the source string is specified in the msgid_plural lines.


a.Purpose: one of the variants of the plural form.
b.Example: %s days.
c.Explanation: the translation string is specified in the msgstr [X] string

Translation process:

  1. Based on one of the existing .po files, it is necessary to prepare the .pot file that contains only source lines with original texts.

  2. Translate the template (.pot) file into the required languages.

  3. When uploading translations to files CLOUDGN will automatically create .pot files with the corresponding lines of the original and translation.

  4. Rename unloaded .pot files to .po files.