You are here

function i18n_variable_init in Internationalization 5.2

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

Initialization of multilingual variables

Parameters

$language: Language to retrieve variables. Defaults to current language

$prefix: Variable name prefix to load just a selected group of variables

2 calls to i18n_variable_init()
i18n_init in ./i18n.module
Implementation of hook_init()
i18n_nodeapi in ./i18n.module
Implementation of hook_nodeapi().

File

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

Code

function i18n_variable_init($language = NULL, $prefix = '') {
  global $conf;
  global $i18n_conf;
  $language = $language ? $language : _i18n_get_lang();
  if ($i18n_variables = variable_get('i18n_variables', '')) {
    if (!$i18n_conf) {
      $i18n_conf = array();
    }
    $variables = _i18n_variable_init($language, $prefix);
    foreach ($i18n_variables as $name) {
      $i18n_conf[$name] = isset($variables[$name]) ? $variables[$name] : (isset($conf[$name]) ? $conf[$name] : '');
    }
    $conf = array_merge($conf, $i18n_conf);
  }
}