1 locale.inc _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.

Return value

New content of the 'javascript_parsed' variable.:


core/includes/locale.inc, line 730
Administration functions for locale.module.


function _locale_invalidate_js($langcode = NULL) {
  $parsed = state_get('locale_javascript_parsed', array());

  if (empty($langcode)) {
    // Invalidate all languages.
    $languages = language_list();
    if (!locale_translate_english()) {
    foreach ($languages as $language_code => $data) {
      $parsed['refresh:' . $language_code] = 'waiting';
  else {
    // Invalidate single language.
    $parsed['refresh:' . $langcode] = 'waiting';

  state_set('locale_javascript_parsed', $parsed);
  return $parsed;