GettextTranslator.Util.PoHelper (gettext_translator v0.9.2)

Copy Markdown View Source

Helpers for updating Expo.Message structs with translation entries.

Summary

Functions

Updates a PO message with a new translation.

Functions

get_message_id(arg1)

update_po_message(msg, translation)

Updates a PO message with a new translation.

For plural messages the PO file itself defines how many plural forms the language uses (one msgstr[n] per form), so only the forms tracked by the translation entry (msgstr[0] and msgstr[1]) are replaced. Higher forms (msgstr[2]+) already present in the file are preserved as-is; they are only filled with the generic plural translation when still empty, so newly translated messages don't end up with blank forms.

An explicit :plural_translation_2 key on the translation entry overrides msgstr[2] when present and non-empty.