I maintain a pluggable Django app that contains translations. All strings in Python and HTML code are written in English. When translating the strings to German, I'm always fighting with the problem that German differentiates between formal and informal speech (see T–V distinction). Because the app is used on different sites, ranging from a social network to a banking website, I can't just support either the formal or informal version. And since the translations can differ quite a bit, there's no way I can parameterize it. E.g. the sentence "Do you want to log out?" would have these two translations:
- Wollen Sie sich abmelden? (formal)
- Willst du dich abmelden? (informal)
Is there anything in Gettext that could help me with this?
You can use contextual markers to give your translations additional context.
...
The best approach, used in other similar situations by gettext as well as UNIX is to use locale variants. For example,
sr_RS
is (or was, because Serbian is considered a metalanguage these days...) code used for Serbian written in Cyrillic. But it’s sometimes written in Latin script too, sosr_RS@latin
is used as the language name and of course, the MO filename or directory as well.Here, have a look at some translations I have present on my system:
So the best way to handle German variants is the same: use
de
(orde_DE
) for the base informal variant and have a separate translation filede_DE@formal
with the formal variant of the translation.This is basically what WordPress does too. Of course, being WordPress, they have their own special flavour and don’t use the variant syntax, but instead add a third component to the filename:
de_DE.mo
is the informal (and also fallback, because it lacks any further specification) variant andde_DE_formal.mo
contains the formal variant.