You are here

function _i18nviews_localize_object in Internationalization Views 6.2

Translate a group of fields for an object.

We cannot play with object 2 array conversion because some are real typed objects.

File

./i18nviews.module, line 177
Views support for Internationalization (i18n) package

Code

function _i18nviews_localize_object($name, $group, &$data, &$field_names, $trim = FALSE) {
  $translated = array();
  foreach ($field_names as $field) {
    if (!empty($data->{$field})) {
      $data->{$field} = i18nstrings("views:{$name}:{$group}:{$field}", $data->{$field});
    }
  }
  if ($trim && $translated) {
    $field_names = array_diff($field_names, $translated);
  }
}