Updated: Comment #31
As has been mentioned elsewhere, we don't yet have guidelines on when and how to use string contexts (= translation contexts). Due to lack of guidelines every developer/module maintainer re-invents the wheel and decides on their own context strings. This results in a great variety of contexts, some good, some not. Further, the lack of guidelines for context, makes it difficult for module/core maintainers to accept string context suggestions. As a result discussions come to a standstill or bad contexts get accepted.
For examples of real-life string context issue, see the list of issues tagged with "string context".
Create a description of string context for both developers and translators. Including criteria for string context and examples of good and bad contexts.
- Agree on criteria for string context
- Complete the string context documentation page with this information.
- Get this documentation promoted to be a coding standard page.
String context criteria
Define a context that:
- Fixes an actual translation problem that has been identified due to the lack of context.
- Allows a translator to distinguish the meaning of the string and decide on the right translation.
- Is reusable.
- Provides information on the meaning of the string.
- Is short and concise (phrase rather than a full sentence).
- Only add the context to the string in the deviating context. The dominant use of the string does not receive a context.
Avoid the following in context definition:
- Linguistic contexts like: "Verb", "Noun" or "Dative". This usually does not provide enough distinction
- "Module name". Module names are usually not translated. If the module name is the donimant use of the string, it will not receive a context.
- Don't use a module name. It silos the use within (groups of) modules and prevents collaboration between modules.
- Don't use functional part of the module where the string is used (e.g. "Block"), function name or php class name. This is not re-usable and this context may change over time.
Arguments from the original report by @zirvap
- Context is used to give additional information about strings to translators, for strings which would otherwise be difficult to translate well.
- General rule of thumb: If a string has several possible meanings (ie. "May" which can be both the complete month name and a three-letter abbreviation of the name), we use the bare string for one meaning, and add context to others. For instance: "May" without any context is the abbreviation, "May" with context "Long month name" is the complete name.
- Contexts should be reused. (For instance, a contrib module should not introduce "May" with context "Complete month name", it should reuse the core context.
( is necessary for this)