Score:0

The use of contexts in a Drupal.t() function in Javascript

ru flag
fxa

According to the documentation, we can use contexts with Drupal.t() since Drupal 8.

Drupal.t('May', {}, {context: "Long month name"}); works fine, but Drupal.t('May', {}, {context: "Abbreviated month name"}); doesn't translate May.

Why?

Jaypan avatar
de flag
How are you determining it doesn't work?
fxa avatar
ru flag
fxa
In French it must return "Mai" ... but it returns "May".
leymannx avatar
ne flag
Have you translated the string in the new context already?
fxa avatar
ru flag
fxa
Of course... in php the t('May', {}, {context: "Abbreviated month name"}) works fine
berliner avatar
bd flag
Please provide more feedback, for example the code, expected output and actual output of what is currently working, the same for what is not working, and maybe a bit more info around it, that helps people here to help you.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.