You are here

function _locale_invalidate_js in Drupal 6

Same name and namespace in other branches
  1. 8 core/modules/locale/locale.module \_locale_invalidate_js()
  2. 7 includes/locale.inc \_locale_invalidate_js()
  3. 9 core/modules/locale/locale.module \_locale_invalidate_js()

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.

Parameters

$langcode: The language code for which the file needs to be refreshed.

Return value

New content of the 'javascript_parsed' variable.

Related topics

4 calls to _locale_invalidate_js()
locale_add_language in includes/locale.inc
API function to add a language.
locale_translate_delete_form_submit in includes/locale.inc
Process string deletion submissions.
locale_translate_edit_form_submit in includes/locale.inc
Process string editing form submissions.
_locale_import_po in includes/locale.inc
Parses Gettext Portable Object file information and inserts into database
2 string references to '_locale_invalidate_js'
locale_update_6007 in modules/locale/locale.install
Fix Drupal.formatPlural().
locale_update_js_files in modules/locale/locale.module
Update JavaScript translation file, if required, and add it to the page.

File

includes/locale.inc, line 2121
Administration functions for locale.module.

Code

function _locale_invalidate_js($langcode = NULL) {
  $parsed = variable_get('javascript_parsed', array());
  if (empty($langcode)) {

    // Invalidate all languages.
    $languages = language_list();
    unset($languages['en']);
    foreach ($languages as $lcode => $data) {
      $parsed['refresh:' . $lcode] = 'waiting';
    }
  }
  else {

    // Invalidate single language.
    $parsed['refresh:' . $langcode] = 'waiting';
  }
  variable_set('javascript_parsed', $parsed);
  return $parsed;
}