1 view.inc public view::init_localization()

Find and initialize the localization plugin.

Return value

bool: Whether the active plugin does handle translation or not. FALSE for the plugin "none", or if no plugin was available.

See also

unpack_options()

File

core/modules/views/includes/view.inc, line 2004
Provides the view object type and associated methods.

Class

view

Code

public function init_localization() {
  // If the translate attribute isn't set, init the localization plugin.
  if (!isset($this->localization_plugin->translate)) {
    $this->localization_plugin = views_get_plugin('localization', views_get_localization_plugin());

    // If the plugin is still not set, turn off all localization by using the
    // views_plugin_localization_none plugin. This plugin has the translate
    // property set to FALSE, signifying localization should not occur.
    if (empty($this->localization_plugin)) {
      $this->localization_plugin = views_get_plugin('localization', 'none');
      // If it is still NULL, not even plugin "none" is available. Only needed
      // for edge cases, like core update.
      if (is_null($this->localization_plugin)) {
        return FALSE;
      }
    }

    // Init the plugin.
    $this->localization_plugin->init($this);
  }

  // Return the value of the translate property. This is set to FALSE if
  // localization is off.
  return $this->localization_plugin->translate;
}