By gábor hojtsy on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Introduced in version:
7.10
Issue links:
Description:
This was unfortunately not done in time for the release of Drupal 7.0, so while you can use string context values in t() to designate a specific meaning of a string, this was not possible in JavaScript. Drupal 7 versions > 7.9 and Drupal 8 solves this problem.
PHP in Drupal 7 and 8:
$short_may = t('May');
$long_may = t('May', array(), array('context' => 'Long month name'));
JavaScript in Drupal 7 versions < 7.10:
shortMay = Drupal.t('May');
longMay = .... not possible in JS ....
JavaScript in Drupal 7 versions > 7.9 and Drupal 8:
shortMay = Drupal.t('May');
longMay = Drupal.t('May', {}, {context: "Long month name"});