Translation with context
See original GitHub issueMotivation
- One phrase can have different meanings in different contexts.
- Fixing an incorrect translation in one context makes the translation incorrect in another context.
Get a feeling of the problem: https://www.youtube.com/watch?v=GAgp7nXdkLU Solution: Translations must be context-specific.
Examples
Phrase | Context | Translation (German) |
---|---|---|
Submit | Accounting | Buchen |
Submit | Comment | Senden |
Change amount | POS | Rückgeld |
Change amount | Stock | Menge ändern |
Proposal
- Call the translation function
frappe._()
with a second parametercontext
.
_("Submit", context="Submit a DocType")
# ...
_("Submit", context="Submit a Comment")
Alternatively, we could use IDs wherever the text should be inserted and extract some context automatically.
-
Per default, there is the same translation for all contexts (see 1.)
-
The translator has the option to provide a different translation for a specific context (see 3.)
The context could also take a different form, such as the route of the view, a screenshot of the UI, or even a dict with more detailed information such as the gender of the user.
Additional considerations
-
It should be possible to lock correct translations. (The current system of status points proved to be insufficient for this.)
-
Consistency of translations across the system must be assured.
-
The project’s terminology and concepts should be defined (for all languages).
- How do we address the user (formal or informal)?
- How to use common terms (“E-Mail” or “eMail” or “email”)?
- Example
See also
- https://github.com/frappe/frappe/issues/2381
- https://github.com/frappe/frappe/issues/2382
- https://github.com/frappe/frappe/issues/19147 (Same issue)
- https://discuss.frappe.io/t/enhancement-translation-moudel/259 (Same issue)
- https://discuss.erpnext.com/t/specific-translationsindentifiers/13067 (Same issue)
- https://discuss.erpnext.com/t/suggestion-retire-erpnext-translator-and-move-to-launchpad-or-similar/20294 (Switch to a different tool that supports context)
Bounty
This feature request is backed financially by the following companies. The bounty is dedicated to an effort to make good translations possible, for which the proposed feature is a necessary basis. If some part of the budget will be left, please propose additional improvements.
USD 500.00 by ALYF GmbH (@alyf-de) USD 500.00 by itsdave (@itsdaveit) USD 500.00 by Libracore (@libracore) USD 500.00 by LIS Engineering GmbH USD 500.00 by //SEIBERT/MEDIA (@seibert-media)
USD 2500.00 Total
Please leave a comment or text me, if you’d like to contribute as well. Discuss: https://discuss.erpnext.com/t/translations-should-be-context-specific/46114
Final thought: a good translation tool could also pay for itself.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:23
- Comments:19 (7 by maintainers)
Top GitHub Comments
Sounds like something desperately needed for all translations.
In NAVISION (Microsoft Dynamics NAV, …) for example every “Object” is identified and has its own translations.
What is an object in this case? Every field in a table, every control (Button, Label, …) in a Form/Page/Report or label in a report etc. If a field in a Form/Report is related to a field of a table the translation will be inherited - but this translation can be overidden.
The disadvantage is that every object has to be translated. And that is a lot of work. There is no “gettext” to make things simple. The advantage is that there is always the correct translation available (if the developer or consultant has added the translation 😃. Moreover there is an automatic fallback to the English original. Obviously developers have build functions to make things easier. But it is always possible to see the context and this makes the translation secure.
In ERPnext some of translations are totally wrong which leads to misunderstandings. For the user it is sometimes funny seeing the strange translation. Funny things will get embarrasing or unprofessional if the “funny” translation find their way into official documents like invoices or quotations.
Just my 2 cents.