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
# better a translation with context than no translation
translations[m.id] =m.string
Because intermediary dicts (1 per app) are merged in order, then a later de-contextualized translation (= a fallback) can overwrite a non-contextual one, which should be of a higher priority.
translations.update(get_translations_from_csv(lang, app) or {})
translations.update(get_translations_from_mo(lang, app) or {})
Example
The following PO files of two different applications:
# app1.po# no contextmsgid"FROM"msgstr"From"
# app2.pomsgctxt"Communication"msgid"FROM"msgstr"Communication sent by"
Will be converted to these two dicts:
app1_translations= {
"FROM": "From",
}
app2_translations= {
"FROM": "Communication sent by", # 🚨 this is the bug"FROM:Communication": "Communication sent by",
}
Which, when merged in order, won't produce the expected result.
Expected
_("FROM") # -> From_("FROM", context="Communication") # -> Communication sent by
Actual
_("FROM") # -> Communication sent by_("FROM", context="Communication") # -> Communication sent by
The text was updated successfully, but these errors were encountered:
(low-priority bug /cc @barredterra)
Explanation
This bug is introduced when catalogs are merged across applications, because of the following lines:
frappe/frappe/gettext/translate.py
Lines 302 to 304 in 9e8808f
Because intermediary dicts (1 per app) are merged in order, then a later de-contextualized translation (= a fallback) can overwrite a non-contextual one, which should be of a higher priority.
frappe/frappe/translate.py
Lines 176 to 178 in 9e8808f
Example
The following PO files of two different applications:
Will be converted to these two dicts:
Which, when merged in order, won't produce the expected result.
Expected
Actual
The text was updated successfully, but these errors were encountered: