_locale_invalidate_js($langcode = NULL)
Force the JavaScript translation file(s) to be refreshed.
This function sets a refresh flag for a specified language, or all languages except English, if none specified. JavaScript translation files are rebuilt (with locale_update_js_files()) the next time a request is served in that language.
$langcode: The language code for which the file needs to be refreshed.
New content of the 'system.javascript_parsed' variable.
function _locale_invalidate_js($langcode = NULL) { $parsed = \Drupal::state()->get('system.javascript_parsed') ? : array(); if (empty($langcode)) { // Invalidate all languages. $languages = locale_translatable_language_list(); foreach ($languages as $lcode => $data) { $parsed['refresh:' . $lcode] = 'waiting'; } } else { // Invalidate single language. $parsed['refresh:' . $langcode] = 'waiting'; } \Drupal::state()->set('system.javascript_parsed', $parsed); return $parsed; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!locale!locale.module/function/_locale_invalidate_js/8.1.x