You are here

function locale_refresh_cache in Drupal 4

Same name and namespace in other branches
  1. 5 modules/locale/locale.module \locale_refresh_cache()

Refreshes database stored cache of translations.

We only store short strings to improve performance and consume less memory.

3 calls to locale_refresh_cache()
locale in modules/locale.module
Provides interface translation services.
_locale_string_delete in includes/locale.inc
Delete a language string.
_locale_string_edit_submit in includes/locale.inc
Process string editing form submissions. Saves all translations of one string submitted from a form.

File

modules/locale.module, line 233
Enables administrators to manage the site interface languages.

Code

function locale_refresh_cache() {
  $languages = locale_supported_languages();
  foreach (array_keys($languages['name']) as $locale) {
    $result = db_query("SELECT s.source, t.translation, t.locale FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid WHERE t.locale = '%s' AND LENGTH(s.source) < 75", $locale);
    $t = array();
    while ($data = db_fetch_object($result)) {
      $t[$data->source] = empty($data->translation) ? TRUE : $data->translation;
    }
    cache_set("locale:{$locale}", serialize($t));
  }
}