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);

Riadh Rahmi

Senior Web Developer (Drupal & Laravel)

I am a senior web developer, I have experience in planning and developing large scale dynamic web applications especially in Drupal and Laravel.

Web Posts

Search

Page Facebook