Please Disable Your Browser Adblock Extension for our site and Refresh This Page!

our ads are user friendly, we do not serve popup ads. We serve responsible ads!

Refresh Page
Skip to main content
On . By CodimTh
Category:

we still have here the Drupal.t() and Drupal.formatPlural() functions to translate our interface text. To be able to use them you need to require the core/drupal library as a dependency in your library entry.

Drupal.t()

Drupal.t("My String");

Clear the Drupal Cache.

This string appear in /admin/config/regional/translate

if not then check your libraries.yml file
And add the corresponding dependencies THEME.libraries.yml:

dependencies:
  - core/jquery
  - core/drupal

 

Examples:

Drupal.t('Something to translate');
Drupal.t('Comments to @type posts', {'@type': typeName});
Drupal.t('Something to translate', {}, {context: 'Javascript'});

var x = 'First text to translate';
Drupal.t(x);

Comments

Add new comment

Restricted HTML

Search

Page Facebook

Become a patron

If you need some help or you search a Drupal freelancer don't hesitate to contact us.

 

Contact Us

All the content is FREE but I still need your help

 

Become a patreon