You are here

function path_breadcrumbs_i18n_clone in Path Breadcrumbs 7.3

Copy translations from source to destination.

1 call to path_breadcrumbs_i18n_clone()
path_breadcrumbs_i18n_path_breadcrumbs_save in path_breadcrumbs_i18n/path_breadcrumbs_i18n.module
Implements hook_path_breadcrumbs_save().

File

path_breadcrumbs_i18n/path_breadcrumbs_i18n.module, line 137
Internationalization (i18n) integration.

Code

function path_breadcrumbs_i18n_clone($path_breadcrumbs_source, $path_breadcrumbs_destination) {
  $object_s = i18n_object('path_breadcrumbs', $path_breadcrumbs_source);
  $object_d = i18n_object('path_breadcrumbs', $path_breadcrumbs_destination);
  $strings_s = $object_s
    ->get_strings(array(
    'empty' => TRUE,
  ));
  $strings_d = $object_d
    ->get_strings(array(
    'empty' => TRUE,
  ));
  $cnt = count($strings_s);
  if (!$cnt || count($strings_s) != count($strings_d)) {
    return FALSE;
  }
  $languages = i18n_language_list('language');
  unset($languages[i18n_string_source_language()]);
  for ($i = 0; $i < $cnt; $i++) {
    $pair_s = each($strings_s);
    $pair_d = each($strings_d);
    foreach ($languages as $lang) {
      $translation = $pair_s['value']
        ->get_translation($lang);
      i18n_string_translation_update($pair_d['key'], $pair_s['value']
        ->get_translation($lang), $lang);
    }
  }
}