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 2002
Provides the view object type and associated methods.

Class

view
An object to contain all of the data to generate a view, plus the member functions to build the view query, execute the query and render the output.

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;
}