function _webform_localization_analysis_data_select in Webform Localization 7.4
Implements _webform_localization_analysis_data_component().
File
- components/
select.inc, line 82 - Webform localizations for select component.
Code
function _webform_localization_analysis_data_select($data, $node, $component) {
if (!isset($component['extra']['translated_strings']) || !is_array($component['extra']['translated_strings'])) {
return $data;
}
$item_key_lookup = _webform_localization_string_to_key($component['extra']['items']);
foreach ($component['extra']['translated_strings'] as $name) {
$name_list = explode(':', $name);
// Translate options.
if (strpos($name_list[3], '-') !== FALSE) {
list(, $key) = explode('-', $name_list[3]);
if (isset($item_key_lookup[$key])) {
foreach ($data['table_rows'] as $index => $row) {
if ($row[0] == $item_key_lookup[$key]) {
$data['table_rows'][$index][0] = i18n_string($name, $row[0]);
}
}
}
}
}
return $data;
}