You are here

public function i18n_string_object::set_translation in Internationalization 7

Set translation for language

Parameters

$translation: Translation object (from database) or string

1 call to i18n_string_object::set_translation()
i18n_string_object::get_translation in i18n_string/i18n_string.inc
Get translation to language from string object

File

i18n_string/i18n_string.inc, line 188
API for internationalization strings

Class

i18n_string_object
String object that contains source and translations.

Code

public function set_translation($translation, $langcode = NULL) {
  if (is_object($translation)) {
    $langcode = $langcode ? $langcode : $translation->language;
    $string = isset($translation->translation) ? $translation->translation : FALSE;
    $this
      ->set_properties($translation);
  }
  else {
    $string = $translation;
  }
  $this->translations[$langcode] = $string;
  return $this;
}