Gettext PO/POT format is fully supported including plurals and context information.
See the full specification for more details.
Context information 🔗
These comments are parsed and processed:
#
- general comment#.
- extracted comment#:
- reference
Texts 🔗
The standard format for single and multi-line line strings is fully supported.
# Single line
msgctxt "Context"
msgid "Input text"
msgstr "Translation"
# Multiple lines
msgid ""
"The input text\n"
"splitted to several\n"
"lines"
msgstr "Translation\n"
"can also be splitted."
Plurals 🔗
Plurals are fully supported in the standard form described below.
msgid ""
msgstr ""
"..."
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"..."
msgid "Just one user online"
msgid_plural "There are %d users online"
msgstr[0] "Un seul utilisateur en ligne"
msgstr[1] "Il y a %d utilisateurs en ligne"
We generate Plural-Forms
field in the header from the latest CLDR data, so the formula may be a bit different. However, it should be accurate and recent.
Use key for missing texts 🔗
Enable use_key_for_content in features in the upload section to use the msgid as a content where msgstr is empty.
POT format support 🔗
Use pot as the type or enable force_key_for_content for the po type in the upload section to use msgid as the content.
Working with empty translations 🔗
If you, for some reason, need to preserve empty translations, you will need two options that you can use in features in the upload section.
Feature | Description |
---|---|
ignore_blank_content |
By default, empty translations in the input file are considered a valid empty translation. There are many reasons when using empty translation is a valid case. With this option enabled, empty translations are filtered out and the string is considered untranslated. |
empty_untraslated |
This feature tells Localazy to output untranslated strings as empty translation. |
Filtering untranslated strings 🔗
By default, when the output file is generated, Localazy uses texts from the source languages when the translation in the exported language is missing.
This approach is safeguarding you from missing keys that can lead to crashes in some solutions/frameworks.
This feature can be disable by adding filter_untranslated
to features in the upload section and reuploading your source language file.
Generating MO 🔗
You can instruct Localazy to generate binary MO files instead of PO files. Add output_mo
to features in the upload section to enable it.
If you need both PO and MO files, you can use Format Conversions in your localazy.json
. For example:
{
"readKey": "---",
"writeKey": "---",
"upload": {
"files": "locales/en.po"
},
"download": {
"files": "my_po_files/${lang}.po"
},
"conversion": {
"actions": {
"type": "mo",
"output": "my_mo_files/${lang}.mo"
}
}
}