1 views_plugin_localization_core.inc public views_plugin_localization_core::save_string($string, $keys = array(), $format = '')

Save a string for translation.

Parameters

string $string: The string to be translated.

array $keys: An array of keys to identify the string. Generally constructed from view name, display_id, and a property, e.g., 'header'.

string $format: The input format of the string. This is optional.

Overrides views_plugin_localization::save_string

File

core/modules/views/plugins/views_plugin_localization_core.inc, line 40
Definition of views_plugin_localization_core.

Class

views_plugin_localization_core
Localization plugin to pass translatable strings through t().

Code

public function save_string($string, $keys = array(), $format = '') {
  // Find a language that is not "en" (if available) to trigger an entry
  // in module locale's db tables, even if current language is "en".
  $langcode = 'en';
  $languages = language_list();
  unset($languages['en']);
  if (!empty($languages)) {
    $other_language = reset($languages);
    $langcode = $other_language->langcode;
  }
  t($string, array(), array('langcode' => $langcode));

  return TRUE;
}