I am looking at gettext
and .po
files for creating a multilingual application. My understanding is that in the .po
file msgid
is the source and msgstr
is the translation. Accordingly I see 2 ways of defining msgid
:
Using full text (e.g. "My name is %s.\n"
) with the following advantages:
- when calling
gettext
you can clearly see what is about to be translated - it's easier to translate
.po
files because they contain the actual content to be translated
Using a key (e.g. my-name %s
) with the following advantages:
- when the source text is long (e.g. paragraph about company),
gettext
calls are more concise which makes your views cleaner - easier to maintain several
.po
files and views, because the key is less likely to change (e.g. key ofcompany-description
far less likely to change than the actual company description)
Hence my question:
Is there a way of working with gettext
and .po
files that allows combining the advantages of both methods, that is:
-usage of a keys for gettext
calls
-ability for the translator to see the full text that needs to be translated?