Open WillsB3 opened 8 years ago
Maybe they should be written to the PO as msgctxt
rather than comments? The PO spec allows duplicate msgids, as long as they have different msgctxts.
I did some cursory digging but haven't found any good examples of msgctxt support in Jinja2 templates. We can alter the default i18n extension to add support for this. Have you been able to find any examples of folks that have implemented msgctxt support with Jinja2's i18n extension?
A quick Google threw this up: https://github.com/clouserw/tower — might be worth a look?
Otherwise, Django supports msgctxts, which could be used for inspiration.
Looking into this some more, there are two different routes that we could take to incorporate the msgctxt
.
pgettext
support into jinja templates.pgettext
functions.My preference would be to try and get the babel support functions working instead of trying to rely on django.
If I have a translation tagged string like this in my doc:
and I have the exact same string in another doc, but have not provided a translator comment, like so:
The translator comment provided in
thing_a@#
doesn't get extracted to the .po file with the actual string forthing_a
/thing_b
.Now, in my use case we've not had an instance where the same word has been used in multiple contexts, but I see that as potentially being a problem - If I provide a different translator comment for each occurrence of the word "Hello" should both comments be extracted into the .po...?
Should these be treated as two separate strings in the .po?...