You are here

public function i18n_string_object_wrapper::translate in Internationalization 7

Translate object.

Translations are cached so it runs only once per language.

Return value

object/array A clone of the object with its properties translated.

Overrides i18n_object_wrapper::translate

File

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

Class

i18n_string_object_wrapper
String object wrapper

Code

public function translate($langcode, $options = array()) {

  // We may have it already translated. As objects are statically cached, translations are too.
  if (!isset($this->translations[$langcode])) {
    $this->translations[$langcode] = $this
      ->translate_object($langcode, $options);
  }
  return $this->translations[$langcode];
}