function i18ncck_locale_refresh in Internationalization 6
Refresh locale strings.
1 call to i18ncck_locale_refresh()
- i18ncck_enable in i18ncck/
i18ncck.install - Implementation of hook_enable().
1 string reference to 'i18ncck_locale_refresh'
- i18ncck_locale in i18ncck/
i18ncck.module - Implementation of hook_locale().
File
- i18ncck/
i18ncck.module, line 32 - Internationalization (i18n) submodule: CCK.
Code
function i18ncck_locale_refresh() {
foreach (content_types() as $content_type => $type) {
// Localization of CCK fields.
if (isset($type['fields'])) {
foreach ($type['fields'] as $field_name => $field) {
// Localize field title and description per content type.
i18nstrings_update('cck:field:' . $content_type . '-' . $field_name . ':widget_label', $field['widget']['label']);
if (!empty($field['widget']['description'])) {
i18nstrings_update('cck:field:' . $content_type . '-' . $field_name . ':widget_description', $field['widget']['description']);
}
// Localize allowed values per field.
if (empty($field['allowed_values_php']) && !empty($field['allowed_values'])) {
$function = $field['module'] . '_allowed_values';
$allowed_values = function_exists($function) ? $function($field) : (array) content_allowed_values($field);
if (!empty($allowed_values)) {
foreach ($allowed_values as $key => $value) {
i18nstrings_update('cck:field:' . $field_name . ':option_' . i18ncck_get_safe_value($key), $value);
}
}
}
}
}
// Localization of CCK fieldgroups.
if (module_exists('fieldgroup')) {
foreach (fieldgroup_groups($content_type) as $group_name => $group) {
i18nstrings_update('cck:fieldgroup:' . $content_type . '-' . $group_name . ':label', $group['label']);
if (!empty($group['settings']['form']['description'])) {
i18nstrings_update('cck:fieldgroup:' . $content_type . '-' . $group_name . ':form_description', $group['settings']['form']['description']);
}
if (!empty($group['settings']['display']['description'])) {
i18nstrings_update('cck:fieldgroup:' . $content_type . '-' . $group_name . ':display_description', $group['settings']['display']['description']);
}
}
}
}
return TRUE;
// Meaning it completed with no issues
}