Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.1.3
-
Fix Version/s: 3.2
-
Component/s: Internationalisation
-
Labels:None
Description
Here is a little patch to add a parameter to the ts() function to specify a context (it is the term used by gettext).
Inspired from: https://developer.mozilla.org/en/gettext#Using_context_with_msgctxt
Let's take an example of french translation, with the string "Tag":
- the action "Tag" becomes "Tagger"
- the noun "Tag" becomes "Tag"
So I need to specify the context like that:
- ts('Tag', array('context' => 'action'));
- ts('Tag', array('context' => 'noun'));
In the .po file, I have:
msgid "action|Tag"
msgsrc "Tagger"
and
msgid "noun|Tag"
msgsrc "Tag"
Of course I can omit the context, and use normal msgid/msgsrc strings.
TODO: smarty
{ts}wrapper, but perhaps it is automatic because I used the $params variable of the ts() function.