Details
-
Epic
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
-
None
-
tr-context
Description
The documentation and examples so far recommend using an automatic translation context for non-id-based translations:
- For C++, this is typically the name of the QObject subclass
- For .ui files, it is the class name
- For QML, it is the file name
Anyhow, this automatic context is often a poor approximation of the semantic context:
- Class and form names are often very technical, not actually giving translators much hints
- Parsing e.g. C++ for deriving the correct context at runtime is complex and error prone
- They are often too fine-grained, leading to lots of contexts with little text, hammering translation reuse
- Just renaming classes and files will lead to outdated translations
We should steer users away from relying too much on the automatic context:
- For QML, you can use pragma Translator on a file level
- For C++, e.g. Qt Creator adapted a pattern to define an explicit context on plugin level