function finder_i18nstrings_translate_strings in Finder 6
Same name and namespace in other branches
- 7 modules/finder_i18nstrings/finder_i18nstrings.module \finder_i18nstrings_translate_strings()
Recursively translate strings using the map.
1 call to finder_i18nstrings_translate_strings()
- finder_i18nstrings_finderapi in modules/
finder_i18nstrings/ finder_i18nstrings.module - Implementation of hook_finderapi().
File
- modules/
finder_i18nstrings/ finder_i18nstrings.module, line 224 - The finder string translation module.
Code
function finder_i18nstrings_translate_strings(&$object, $map) {
if (!empty($map)) {
$was_object = FALSE;
if (is_object($object)) {
$was_object = TRUE;
$object = (array) $object;
}
foreach ($map as $key => $value) {
if (is_string($object[$key]) && !empty($value['#i18nstrings'])) {
$object[$key] = i18nstrings($value['#i18nstrings'], $object[$key]);
}
elseif (is_array($map[$key])) {
finder_i18nstrings_translate_strings($object[$key], $map[$key]);
}
}
if ($was_object) {
$object = (object) $object;
}
}
}