You are here

function _i18n_variable_init in Internationalization 6

Same name and namespace in other branches
  1. 5.3 i18n.module \_i18n_variable_init()
  2. 5 i18n.module \_i18n_variable_init()
  3. 5.2 i18n.module \_i18n_variable_init()

Load language variables into array.

2 calls to _i18n_variable_init()
i18n_variable_get in ./i18n.module
Get single multilingual variable
i18n_variable_init in ./i18n.module
Initialization of multilingual variables.

File

./i18n.module, line 758
Internationalization (i18n) module.

Code

function _i18n_variable_init($langcode) {
  global $i18n_conf;
  if (!isset($i18n_conf[$langcode])) {
    $cacheid = 'variables:' . $langcode;
    if ($cached = cache_get($cacheid)) {
      $i18n_conf[$langcode] = $cached->data;
    }
    else {
      $result = db_query("SELECT * FROM {i18n_variable} WHERE language = '%s'", $langcode);
      $i18n_conf[$langcode] = array();
      while ($variable = db_fetch_object($result)) {
        $i18n_conf[$langcode][$variable->name] = unserialize($variable->value);
      }
      cache_set($cacheid, $i18n_conf[$langcode]);
    }
  }
  return $i18n_conf[$langcode];
}