You are here

function finder_ui_i18n_string_translate_strings in Finder 7.2

Recursively translate strings using the map.

1 call to finder_ui_i18n_string_translate_strings()
finder_ui_finder_render in modules/finder_ui/finder_ui.i18n_string.inc
Implements hook_finder_render().

File

modules/finder_ui/finder_ui.i18n_string.inc, line 147
i18n_string.inc

Code

function finder_ui_i18n_string_translate_strings(&$object, $map) {
  if (!empty($map)) {
    $was_array = FALSE;
    if (is_array($object)) {
      $was_array = TRUE;
      $object = (object) $object;
    }
    foreach ($map as $key => $value) {
      if (!empty($object->{$key}) && is_string($object->{$key}) && is_string($value)) {
        $object->{$key} = i18n_string($value, $object->{$key});
      }
      elseif (is_array($value)) {
        finder_ui_i18n_string_translate_strings($object->{$key}, $value);
      }
    }
    if ($was_array) {
      $object = (array) $object;
    }
  }
}