You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using gettext, we have the possibility of distinguishing one same word or phrase to be translated by context, so that it can be translated differently according to the context it's in. So the source word or phrase might be the same, but the translation will be different:
Weblate is picking up on msgctxt because I can see CONTEXT both in the string information box, and in the translation box (see screenshot below).
However, weblate is complaining that the translation is inconsistent, I'm guessing simply because there are different translations of the same source string? It's like weblate is ignoring the Context, which should distinguish between multiple source strings with the same msgid.
Describe the solution you'd like
Weblate should take msgctxt into account when doing consistency checks.
Describe alternatives you've considered
No response
Screenshots
For example, I have a project where I am translating the single possessive preposition "of" into various other languages, since it is needed by the program to build a phrase. However in English there will not always be a definite article that follows, whereas in other languages there will be, and the translation should therefore include the definite article which, in other languages, will most often have gender and number. So we have to distinguish between at least four contexts:
masculine singular
masculine plural
feminine singular
feminine plural
From the above screenshot, we can see that weblate is trying to get me to apply the translation from one context to another context, simply because the msgid is the same. It does not take into account msgctxt when raising inconsistency flags and generating suggested translations.
Additional context
Weblate: 4.10.1
The text was updated successfully, but these errors were encountered:
When looking at the Other occurrences tab, I see that Weblate does distinguish between the situation where the source and the context are the same, or the other situation where the source is the same but the context is different. If it knows the underlying difference, it should take that into account before raising an inconsistency flag:
Describe the problem
When using gettext, we have the possibility of distinguishing one same word or phrase to be translated by context, so that it can be translated differently according to the context it's in. So the source word or phrase might be the same, but the translation will be different:
https://www.gnu.org/software/gettext/manual/html_node/Contexts.html
Even though PHP doesn't have native support for
pgettext
, I found that it is easy enough to implement with this function:Tested and working, when I generate the pot file like this:
Weblate is picking up on
msgctxt
because I can see CONTEXT both in the string information box, and in the translation box (see screenshot below).However, weblate is complaining that the translation is inconsistent, I'm guessing simply because there are different translations of the same source string? It's like weblate is ignoring the Context, which should distinguish between multiple source strings with the same
msgid
.Describe the solution you'd like
Weblate should take
msgctxt
into account when doing consistency checks.Describe alternatives you've considered
No response
Screenshots
For example, I have a project where I am translating the single possessive preposition "of" into various other languages, since it is needed by the program to build a phrase. However in English there will not always be a definite article that follows, whereas in other languages there will be, and the translation should therefore include the definite article which, in other languages, will most often have gender and number. So we have to distinguish between at least four contexts:
From the above screenshot, we can see that weblate is trying to get me to apply the translation from one context to another context, simply because the
msgid
is the same. It does not take into accountmsgctxt
when raising inconsistency flags and generating suggested translations.Additional context
Weblate: 4.10.1
The text was updated successfully, but these errors were encountered: