You are here

function commerce_i18n_object in Commerce Core 7

Translate a data structure using i18n_string, if available.

Parameters

$type: The i18n object type.

$object: The object or array to translate.

$options: An array of options passed along to i18n.

Return value

The translated data structure if i18_string is available, the original otherwise.

See also

i18n_string_object_translate()

11 calls to commerce_i18n_object()
commerce_cart_attribute_widget_title in modules/cart/commerce_cart.module
Returns the title of an attribute widget for the Add to Cart form.
commerce_cart_field_attach_view_alter in modules/cart/commerce_cart.module
Implements hook_field_attach_view_alter().
commerce_cart_field_formatter_settings_summary in modules/cart/commerce_cart.module
Implements hook_field_formatter_settings_summary().
commerce_customer_commerce_checkout_pane_info in modules/customer/commerce_customer.module
Implements hook_commerce_checkout_pane_info().
commerce_customer_field_validate in modules/customer/commerce_customer.module
Implements hook_field_validate().

... See full list

File

./commerce.module, line 403
Defines features and functions common to the Commerce modules.

Code

function commerce_i18n_object($type, $object, $options = array()) {

  // Clone the object, to ensure the original remains untouched.
  if (is_object($object)) {
    $object = clone $object;
  }
  if (module_exists('i18n_string')) {
    return i18n_string_object_translate($type, $object, $options);
  }
  else {
    return $object;
  }
}