Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
A context must be added when calling the function t() because some translatable strings are incorrectly translated due to the lack of context:
E.g. "from" is translated into French as "expéditeur" which is valid only in an e-mail context.
If a context is specified when calling t() like :
t('from', array(), array('context' => 'office_hours'))
instead of t('from')
, the translation issue can be resolved.
Comment | File | Size | Author |
---|---|---|---|
#7 | add_context_to_function_t-2212715-7.patch | 1.08 KB | basillic |
#7 | office_hours_add_context.png | 17.57 KB | basillic |
Comments
Comment #1
basillic CreditAttribution: basillic commentedIn other words, adding a context when calling the function t () allows translators to specify alternative translations.
Comment #2
basillic CreditAttribution: basillic commentedComment #3
johnvI've fixed the texts in the widget. And some other.
I've added French to my system and tested it.
It now looks like this:
So I don't see "expéditeur".
Can your try again?
Perhaps are using another contrib module, that overwrites this word?
Comment #4
johnvComment #6
johnv-deleted-
Comment #7
basillic CreditAttribution: basillic commentedOn a fresh install with French language enabled :
'From' is not translated. Should be "de".
'Until' is translated by "jusqu'à" which is not the better translation : "à" is a better choice.
With this patch, I think a correct translation may be provided for each language.
Comment #9
johnvIn adjacent patch:
- 'Until' is changed to 'To'
- context is added. I thought is would prevant automatic translations, but that seems not to be the case.
- used other function to get lower case, so 'to' translates to 'à', not 'À'.
The word 'From' is automatich translated in my system, but I have some more (basic) modules enabled.
Comment #11
johnvI am not happy with the current approach.
1. A general remark: when setting up a new environment with Drupal 7.x, no translations are downloaded. You need to download a translation yourself:
#2306007: Enable Localization Update to install versions of .po translation files that are older than installed versions of modules/core
2. We have a dependency on DATE_API. It seems that some texts are in DATE module not in DATE_API submodule
3. a translation context for 'day_name' is added. But is is obsolete: #1021424: Use of t() context for month and day names . Day names are in Core, not in Date.
4. The words 'From' and 'To' are translated using complicated algorithms.
- for From: use "starting from @isodate" or remove the word
- for To: use "@from to @to "
Comment #14
johnvComment #16
johnv