function locale_js_translate
Same name and namespace in other branches
- 10 core/modules/locale/locale.module \locale_js_translate()
- 11.x core/modules/locale/locale.module \locale_js_translate()
- 9 core/modules/locale/locale.module \locale_js_translate()
- 8.9.x core/modules/locale/locale.module \locale_js_translate()
Returns a list of translation files given a list of JavaScript files.
This function checks all JavaScript files passed and invokes parsing if they have not yet been parsed for Drupal.t() and Drupal.formatPlural() calls. Also refreshes the JavaScript translation files if necessary, and returns the filepath to the translation file (if any).
Parameters
array $files: An array of local file paths.
\Drupal\Core\Language\LanguageInterface $language_interface: The interface language the files should be translated into.
Return value
string|null The filepath to the translation file or NULL if no translation is applicable.
Deprecated
in drupal:11.5.0 and is removed from drupal:13.0.0. Use \Drupal::service(LocaleJs::class)->jsTranslate() instead.
See also
https://www.drupal.org/node/3616293
File
-
core/
modules/ locale/ locale.module, line 332
Code
function locale_js_translate(array $files = [], $language_interface = NULL) {
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.5.0 and is removed from drupal:13.0.0. Use \\Drupal::service(LocaleJs::class)->jsTranslate() instead. See https://www.drupal.org/node/3616293', E_USER_DEPRECATED);
return \Drupal::service(LocaleJs::class)->jsTranslate($files, $language_interface);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.