Skip to main content

JavaScript

Translatable strings

Translatable strings in Drupal JavaScript

Drupal is known for being highly translatable. The localization team has done a fantastic job building out tools to make Drupal translatable and it's rare to find a contrib module that doesn't properly wrap its strings in the t() function or the lesser known format_plural() function. While the Drupal community is doing fairly well on the PHP side, many people don't know there is a translation system for Drupal JavaScript as well through the use of Drupal.t() functions and Drupal.formatPlural() functions. 

Drupal.t() function

Subscribe to JavaScript