This file parsing code has a few assumptions for the structure of .po file (which are always held in case when file is generated by code in this object).
This file parsing code has a few assumptions for the structure of .po file (which are always held in case when file is generated by code in this object).
1. Each message has comments before the first msgctxt
or msgid
.
2. Multi-line string literals are separated only by empty strings.
3. All message entries are in following order:
* singluar: [msgctxt] msgid msgstr
* plural: [msgctxt] msgid msgid_plural msgstr[0] .. msgstr[N]
4. After entry key there is always a string literal, e.g. no enties like "msgstr\n\"\""
5. Encoding of file is always UTF-8
These assumptions helps to simplify parsing code a lot.