Now all modules are in core modules folder
This commit is contained in:
parent
5ba1cdfa0b
commit
05b6a91b0c
1907 changed files with 0 additions and 0 deletions
14
modules/i18n/i18ncck/i18ncck.info
Normal file
14
modules/i18n/i18ncck/i18ncck.info
Normal file
|
@ -0,0 +1,14 @@
|
|||
name = CCK translation
|
||||
description = Supports translatable custom CCK fields and fieldgroups.
|
||||
dependencies[] = i18n
|
||||
dependencies[] = content
|
||||
dependencies[] = i18nstrings
|
||||
package = Multilanguage
|
||||
core = 6.x
|
||||
|
||||
; Information added by drupal.org packaging script on 2011-10-11
|
||||
version = "6.x-1.10"
|
||||
core = "6.x"
|
||||
project = "i18n"
|
||||
datestamp = "1318336004"
|
||||
|
16
modules/i18n/i18ncck/i18ncck.install
Normal file
16
modules/i18n/i18ncck/i18ncck.install
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Installation file for i18ncck module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implementation of hook_enable().
|
||||
*
|
||||
* Create all strings from CCK for translation.
|
||||
*/
|
||||
function i18ncck_enable() {
|
||||
drupal_load('module', 'i18nstrings');
|
||||
i18ncck_locale_refresh();
|
||||
}
|
102
modules/i18n/i18ncck/i18ncck.module
Normal file
102
modules/i18n/i18ncck/i18ncck.module
Normal file
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Internationalization (i18n) submodule: CCK.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implementation of hook_locale().
|
||||
*/
|
||||
function i18ncck_locale($op = 'groups', $group = NULL) {
|
||||
switch ($op) {
|
||||
case 'groups':
|
||||
return array('cck' => t('CCK'));
|
||||
case 'info':
|
||||
$info['cck']['refresh callback'] = 'i18ncck_locale_refresh';
|
||||
$info['cck']['format'] = FALSE;
|
||||
return $info;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes safe keys for using in i18nstrings().
|
||||
*/
|
||||
function i18ncck_get_safe_value($value) {
|
||||
return html_entity_decode(strip_tags($value), ENT_QUOTES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh locale strings.
|
||||
*/
|
||||
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
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate widget's labels and descriptions.
|
||||
*/
|
||||
function i18ncck_content_field_strings_alter(&$field_strings, $content_type, $field_name) {
|
||||
$field_strings['widget_label'] = i18nstrings('cck:field:'. $content_type .'-'. $field_name .':widget_label', $field_strings['widget_label']);
|
||||
if (!empty($field_strings['widget_description'])) {
|
||||
$field_strings['widget_description'] = i18nstrings('cck:field:'. $content_type .'-'. $field_name .':widget_description', $field_strings['widget_description']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate allowed values lists.
|
||||
*/
|
||||
function i18ncck_content_allowed_values_alter(&$allowed_values, $field) {
|
||||
foreach ($allowed_values as $key => $value) {
|
||||
$allowed_values[$key] = i18nstrings('cck:field:'. $field['field_name'] .':option_'. i18ncck_get_safe_value($key), $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate fieldgroup labels and descriptions.
|
||||
*/
|
||||
function i18ncck_content_fieldgroup_strings_alter(&$group_strings, $content_type, $group_name) {
|
||||
$group_strings['label'] = i18nstrings('cck:fieldgroup:'. $content_type .'-'. $group_name .':label', $group_strings['label']);
|
||||
if (!empty($group_strings['form_description'])) {
|
||||
$group_strings['form_description'] = i18nstrings('cck:fieldgroup:'. $content_type .'-'. $group_name .':form_description', $group_strings['form_description']);
|
||||
}
|
||||
if (!empty($group_strings['display_description'])) {
|
||||
$group_strings['display_description'] = i18nstrings('cck:fieldgroup:'. $content_type .'-'. $group_name .':display_description', $group_strings['display_description']);
|
||||
}
|
||||
}
|
Reference in a new issue