You are here

function i18n_string_object_translate in Internationalization 7

Translate object properties

We clone the object previously so we don't risk translated properties being saved

Parameters

$type: Object type

$object: Object or array

5 calls to i18n_string_object_translate()
i18n_contact_mail_alter in i18n_contact/i18n_contact.module
Implements hook_mail_alter().
i18n_field_field_attach_form in i18n_field/i18n_field.module
Implements hook_field_attach_form().
i18n_field_field_widget_form_alter in i18n_field/i18n_field.module
Implements hook_field_widget_form_alter().
i18n_field_translate_property in i18n_field/i18n_field.module
Translate field property
i18n_taxonomy_localize_terms in i18n_taxonomy/i18n_taxonomy.module
Localize taxonomy terms for localizable vocabularies.

File

i18n_string/i18n_string.module, line 885
Internationalization (i18n) package - translatable strings.

Code

function i18n_string_object_translate($type, $object, $options = array()) {
  $langcode = isset($options['langcode']) ? $options['langcode'] : i18n_langcode();
  if (i18n_string_translate_langcode($langcode)) {

    // Object properties will be returned without filtering as in the original one.
    $options += array(
      'sanitize' => FALSE,
    );
    return i18n_object($type, $object)
      ->translate($langcode, $options);
  }
  else {
    return $object;
  }
}