summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.18/sites/all/modules/i18n
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.18/sites/all/modules/i18n')
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n.info8
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n.test26
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_block/i18n_block.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_contact/i18n_contact.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_field/i18n_field.api.php53
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_field/i18n_field.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_field/i18n_field.module132
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_forum/i18n_forum.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_menu/i18n_menu.inc1
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_menu/i18n_menu.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_menu/i18n_menu.module39
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_node/i18n_node.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_node/i18n_node.pages.inc4
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_path/i18n_path.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_redirect/i18n_redirect.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_select/i18n_select.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.inc4
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.pages.inc17
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_sync/i18n_sync.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_sync/i18n_sync.node.inc11
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module26
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_translation/i18n_translation.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_user/i18n_user.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_variable/i18n_variable.info6
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/tests/i18n_test.info6
27 files changed, 302 insertions, 115 deletions
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n.info
index 28c5770..c81b368 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n.info
@@ -4,15 +4,13 @@ dependencies[] = locale
dependencies[] = variable
package = Multilingual - Internationalization
core = 7.x
-
-files[] = i18n.install
files[] = i18n_object.inc
files[] = i18n.test
configure = admin/config/regional/i18n
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n.test b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n.test
index 247af33..491d7ef 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n.test
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n.test
@@ -144,12 +144,14 @@ class Drupali18nTestCase extends DrupalWebTestCase {
}
/**
- * Create a "Basic page" in the specified language.
- *
+ * Create a node of the specified type in the specified language.
+
+ * @param $type
+ * The node type.
* @param $title
- * Title of basic page in specified language.
+ * Title of node in specified language.
* @param $body
- * Body of basic page in specified language.
+ * Body of node in specified language.
* @param $langcode
* Language code.
*/
@@ -159,7 +161,9 @@ class Drupali18nTestCase extends DrupalWebTestCase {
$edit["body[$lang][0][value]"] = $body;
$edit['language'] = $langcode;
$this->drupalPost('node/add/' . $type, $edit, t('Save'));
- $this->assertRaw(t('Basic @type %title has been created.', array('@type' => $type, '%title' => $title)), t('Basic page created.'));
+ $info = node_type_load($type);
+ $message = t('@name %title has been created.', array('@name' => $info->name, '%title' => $title));
+ $this->assertRaw($message);
// Check to make sure the node was created.
$node = $this->drupalGetNodeByTitle($title);
@@ -169,15 +173,14 @@ class Drupali18nTestCase extends DrupalWebTestCase {
}
/**
- * Create a translation for the specified basic page in the specified
- * language.
+ * Create a translation for the specified node in the specified language.
*
* @param $node
* The basic page to create translation for.
* @param $title
- * Title of basic page in specified language.
+ * Title of node in specified language.
* @param $body
- * Body of basic page in specified language.
+ * Body of node in specified language.
* @param $language
* Language code.
*/
@@ -196,8 +199,9 @@ class Drupali18nTestCase extends DrupalWebTestCase {
$edit["title"] = $title;
$edit[$body_key] = $body;
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertRaw(t('Basic page %title has been created.', array('%title' => $title)), t('Translation created.'));
-
+ $info = node_type_load($node->type);
+ $message = t('@name %title has been created.', array('@name' => $info->name, '%title' => $title));
+ $this->assertRaw($message);
// Check to make sure that translation was successful.
$translation = $this->drupalGetNodeByTitle($title);
$this->assertTrue($translation, t('Node found in database.'));
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_block/i18n_block.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_block/i18n_block.info
index 52de33c..9b1c51e 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_block/i18n_block.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_block/i18n_block.info
@@ -8,9 +8,9 @@ files[] = i18n_block.inc
files[] = i18n_block.test
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_contact/i18n_contact.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_contact/i18n_contact.info
index 9ca0957..fa1351c 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_contact/i18n_contact.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_contact/i18n_contact.info
@@ -5,9 +5,9 @@ dependencies[] = i18n_string
package = Multilingual - Internationalization
core = 7.x
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_field/i18n_field.api.php b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_field/i18n_field.api.php
new file mode 100644
index 0000000..3f5b01c
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_field/i18n_field.api.php
@@ -0,0 +1,53 @@
+<?php
+
+/**
+ * @file
+ * API documentation file for Field translation module.
+ *
+ * This module takes care of translating common field elements like title and
+ * description for all fields, plus some field specific values (default, options)
+ * for field types defined by Drupal core.
+ *
+ * Before implementing any of these hooks, consider whether you would be better
+ * off implementing Drupal core's hook_field_widget_form_alter().
+ *
+ * @see i18n_field_field_widget_form_alter()
+ */
+
+/**
+ * Provide information about callbacks for translating specific field types.
+ *
+ * This information can be retrieved using i18n_field_type_info().
+ * @return
+ * Array of values indexed by field type. Valid keys are:
+ * - 'translate_default', Callback for translating the default value for this field type.
+ * - 'translate_options', Callback for translating options for this field type.
+ *
+ * @see i18n_field_type_info()
+ * @see i18n_field_i18n_field_info()
+ *
+ * For examples of both callback types:
+ *
+ * @see i18n_field_translate_allowed_values()
+ * @see i18n_field_translate_default()
+ *
+ */
+function hook_i18n_field_info() {
+ $info['text'] = $info['text_long'] = $info['text_with_summary'] = array(
+ 'translate_default' => 'i18n_field_translate_default',
+ );
+ $info['list_text'] = $info['list_boolean'] = $info['list_integer'] = array(
+ 'translate_options' => 'i18n_field_translate_allowed_values',
+ );
+ return $info;
+}
+
+/**
+ * Alter information provided by hook_i18n_field_info().
+ *
+ * @see i18n_field_type_info()
+ */
+function hook_i18n_field_info_alter(&$info) {
+ // Unset the default callback for text fields.
+ unset($info['text']['translate_default']);
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_field/i18n_field.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_field/i18n_field.info
index c3a40a3..ebd630e 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_field/i18n_field.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_field/i18n_field.info
@@ -6,9 +6,9 @@ package = Multilingual - Internationalization
core = 7.x
files[] = i18n_field.inc
files[] = i18n_field.test
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_field/i18n_field.module b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_field/i18n_field.module
index f39a6a7..b682397 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_field/i18n_field.module
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_field/i18n_field.module
@@ -163,7 +163,6 @@ function i18n_field_field_formatter_view($entity_type, $entity, $field, $instanc
return $element;
}
-
/**
* Implements hook_field_widget_form_alter().
*
@@ -176,8 +175,8 @@ function i18n_field_field_formatter_view($entity_type, $entity, $field, $instanc
function i18n_field_field_widget_form_alter(&$element, &$form_state, $context) {
global $language;
- // Skip the node type edit fields by checking for existing entity
- if (empty($element['#entity'])) {
+ // Don't translate if the widget is being shown on the field edit form.
+ if ($form_state['build_info']['form_id'] == 'field_ui_field_edit_form') {
return;
}
@@ -189,8 +188,38 @@ function i18n_field_field_widget_form_alter(&$element, &$form_state, $context) {
$instance = $context['instance'];
$langcode = $context['langcode'];
+ // Get the element to alter. Account for inconsistencies in how the element
+ // is built for different field types.
+ if (isset($element[0]) && count($element) == 1) {
+ // Single-value file fields and image fields.
+ $alter_element = &$element[0];
+ }
+ elseif (isset($element['value'])) {
+ // Number fields. Single-value text fields.
+ $alter_element = &$element['value'];
+ }
+ elseif ($field['type'] == 'entityreference' && isset($element['target_id'])) {
+ // Entityreference fields using the entityreference_autocomplete widget.
+ $alter_element = &$element['target_id'];
+ }
+ else {
+ // All other fields.
+ $alter_element = &$element;
+ }
+
+ // If a subelement has the same title as the parent, translate it instead.
+ // Allows fields such as email and commerce_price to be translated.
+ foreach (element_get_visible_children($element) as $key) {
+ $single_value = ($field['cardinality'] == 1);
+ $has_title = (isset($element['#title']) && isset($element[$key]['#title']));
+ if ($single_value && $has_title && $element[$key]['#title'] == $element['#title']) {
+ $alter_element = &$element[$key];
+ break;
+ }
+ }
+
// The field language may affect some variables (default) but not others (description will be in current page language)
- $i18n_langcode = empty($element['#language']) || $element['#language'] == LANGUAGE_NONE ? $language->language : $element['#language'];
+ $i18n_langcode = empty($alter_element['#language']) || $alter_element['#language'] == LANGUAGE_NONE ? $language->language : $alter_element['#language'];
// Translate instance to current page language and set to form_state
// so it will be used for validation messages later.
@@ -200,37 +229,60 @@ function i18n_field_field_widget_form_alter(&$element, &$form_state, $context) {
}
// Translate field title if set and it is the default one.
- // When cardinality is 1, $element['value'] is used instead.
if (!empty($instance_current['label']) && $instance_current['label'] != $instance['label']) {
- if (!empty($element['#title']) && $element['#title'] == $instance['label']) {
- $element['#title'] = $instance_current['label'];
- }
- if (isset($element['value']) && !empty($element['value']['#title']) && $element['value']['#title'] == $instance['label']) {
- $element['value']['#title'] = $instance_current['label'];
+ if (!empty($alter_element['#title']) && $alter_element['#title'] == check_plain($instance['label'])) {
+ $alter_element['#title'] = check_plain($instance_current['label']);
}
}
// Translate field description if set and it is the default one.
- // When cardinality is 1, $element['value'] is used instead.
if (!empty($instance_current['description']) && $instance_current['description'] != $instance['description']) {
- if (!empty($element['#description']) && $element['#description'] == $instance['description']) {
- $element['#description'] = $instance_current['description'];
- }
- if (isset($element['value']) && !empty($element['value']['#description']) && $element['value']['#description'] == $instance['description']) {
- $element['value']['#description'] = $instance_current['description'];
+ if (!empty($alter_element['#description'])) {
+ // Allow single-value file fields and image fields to have their
+ // descriptions translated. file_field_widget_form() passes the
+ // description through theme('file_upload_help'), so i18n_field
+ // must do the same.
+ $filefield = in_array($field['type'], array('file', 'image'));
+ $single_value = ($field['cardinality'] == 1);
+ $no_default = empty($alter_element['#default_value']['fid']);
+ if ($filefield && $single_value && $no_default) {
+ $help_variables = array(
+ 'description' => field_filter_xss($instance['description']),
+ 'upload_validators' => $alter_element['#upload_validators'],
+ );
+ $original_description = theme('file_upload_help', $help_variables);
+ if ($alter_element['#description'] == $original_description) {
+ $help_variables = array(
+ 'description' => field_filter_xss($instance_current['description']),
+ 'upload_validators' => $alter_element['#upload_validators'],
+ );
+ $alter_element['#description'] = theme('file_upload_help', $help_variables);
+ }
+ }
+ elseif ($alter_element['#description'] == field_filter_xss($instance['description'])) {
+ $alter_element['#description'] = field_filter_xss($instance_current['description']);
+ }
}
}
- // Translate list options
- if (!empty($element['#options']) && ($translate = i18n_field_type_info($field['type'], 'translate_options')) && !empty($field['settings']['allowed_values'])) {
- $element['#options'] = $translate($field, $i18n_langcode);
- if (isset($element['#properties']) && !empty($element['#properties']['empty_option'])) {
- $label = theme('options_none', array('instance' => $instance, 'option' => $element['#properties']['empty_option']));
- $element['#options'] = array('_none' => $label) + $element['#options'];
- // For some elements, change title to new translated option
- if (!empty($element['#title']) && $field['type'] == 'list_boolean' && !empty($element['#on_value'])) {
- $on_value = $element['#on_value'];
- $element['#title'] = $element['#options'][$on_value];
+ // Translate list options.
+ $has_options = (!empty($alter_element['#options']) || $field['type'] == 'list_boolean');
+ $has_allowed_values = !empty($field['settings']['allowed_values']);
+ $translate = i18n_field_type_info($field['type'], 'translate_options');
+ if ($has_options && $has_allowed_values && $translate) {
+ $alter_element['#options'] = $translate($field, $i18n_langcode);
+ if (isset($alter_element['#properties']) && !empty($alter_element['#properties']['empty_option'])) {
+ $label = theme('options_none', array('instance' => $instance, 'option' => $alter_element['#properties']['empty_option']));
+ $alter_element['#options'] = array('_none' => $label) + $alter_element['#options'];
+ }
+ // Translate list_boolean fields using the checkboxes widget.
+ if (!empty($alter_element['#title']) && $field['type'] == 'list_boolean' && !empty($alter_element['#on_value'])) {
+ $on_value = $alter_element['#on_value'];
+ $alter_element['#options'];
+ $alter_element['#title'] = $alter_element['#options'][$on_value];
+ // For using label instead of "On value".
+ if ($instance['widget']['settings']['display_label']) {
+ $alter_element['#title'] = $instance_current['label'];
}
}
}
@@ -242,11 +294,15 @@ function i18n_field_field_widget_form_alter(&$element, &$form_state, $context) {
$delta = $context['delta'];
$items = $context['items'];
- // Translate default value if exists and the current value is the default
- if (isset($element['value']['#default_value']) && ($translate = i18n_field_type_info($field['type'], 'translate_default')) &&
- !empty($instance['default_value'][$delta]['value']) && !empty($items[$delta]['value']) &&
- $instance['default_value'][$delta]['value'] === $items[$delta]['value']) {
- $element['value']['#default_value'] = $translate($instance, $items[$delta]['value'], $i18n_langcode);
+ // Translate default value.
+ $has_default_value = (isset($alter_element['#default_value']) && !empty($instance['default_value'][$delta]['value']));
+ $storage_has_value = !empty($items[$delta]['value']);
+ $translate = i18n_field_type_info($field['type'], 'translate_default');
+ if ($has_default_value && $storage_has_value && $translate) {
+ // Compare the default value with the value currently in storage.
+ if ($instance['default_value'][$delta]['value'] === $items[$delta]['value']) {
+ $alter_element['#default_value'] = $translate($instance, $items[$delta]['value'], $i18n_langcode);
+ }
}
}
@@ -344,7 +400,7 @@ function i18n_field_translate_allowed_values($field, $langcode = NULL) {
}
/**
- * Translate field default
+ * Translate field default.
*/
function i18n_field_translate_default($instance, $value, $langcode = NULL) {
return i18n_string_translate(array('field', $instance['field_name'], $instance['bundle'], 'default_value'), $value, array('langcode' => $langcode));
@@ -360,7 +416,17 @@ function i18n_field_translate_property($instance, $property, $langcode = NULL) {
}
/**
- * Get i18n information for fields
+ * Get i18n information for translating fields.
+ *
+ * @param $type
+ * Optional field type.
+ * @param $property
+ * Optional property to get from field type.
+ *
+ * @return
+ * - The property for the field if $type and $property set.
+ * - Array of properties for the field type if only $type is set.
+ * - Array of translation information for all field types.
*/
function i18n_field_type_info($type = NULL, $property = NULL) {
$info = &drupal_static(__FUNCTION__);
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_forum/i18n_forum.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_forum/i18n_forum.info
index d645355..a007cc8 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_forum/i18n_forum.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_forum/i18n_forum.info
@@ -7,9 +7,9 @@ package = Multilingual - Internationalization
core = 7.x
files[] = i18n_forum.test
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_menu/i18n_menu.inc b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_menu/i18n_menu.inc
index 570bf9e..a33d846 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_menu/i18n_menu.inc
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_menu/i18n_menu.inc
@@ -69,6 +69,7 @@ class i18n_menu_link extends i18n_string_object_wrapper {
return I18N_MODE_NONE;
}
}
+
/**
* Access to object translation. This should check object properties and permissions
*/
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_menu/i18n_menu.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_menu/i18n_menu.info
index 0c65b83..a436da1 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_menu/i18n_menu.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_menu/i18n_menu.info
@@ -10,9 +10,9 @@ core = 7.x
files[] = i18n_menu.inc
files[] = i18n_menu.test
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_menu/i18n_menu.module b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_menu/i18n_menu.module
index df670e5..8f91fc5 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_menu/i18n_menu.module
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_menu/i18n_menu.module
@@ -343,6 +343,8 @@ function i18n_menu_variable_info_alter(&$variables, $options) {
// Make menu variables translatable
$variables['menu_main_links_source']['localize'] = TRUE;
$variables['menu_secondary_links_source']['localize'] = TRUE;
+ $variables['menu_parent_[node_type]']['localize'] = TRUE;
+ $variables['menu_options_[node_type]']['localize'] = TRUE;
}
/**
@@ -468,7 +470,8 @@ function i18n_menu_navigation_links($menu_name, $level = 0) {
* Get localized menu title
*/
function _i18n_menu_link_title($link, $langcode = NULL) {
- return i18n_string_translate(array('menu', 'item', $link['mlid'], 'title'), $link['link_title'], array('langcode' => $langcode, 'sanitize' => FALSE));
+ $key = i18n_object_info('menu_link', 'key');
+ return i18n_string_translate(array('menu', 'item', $link[$key], 'title'), $link['link_title'], array('langcode' => $langcode, 'sanitize' => FALSE));
}
/**
@@ -500,7 +503,8 @@ function _i18n_menu_link_localize(&$link, $langcode = NULL) {
*/
function _i18n_menu_link_description($link, $langcode = NULL) {
if (!empty($link['options']['attributes']['title'])) {
- return i18n_string_translate(array('menu', 'item', $link['mlid'], 'description'), $link['options']['attributes']['title'], array('langcode' => $langcode));
+ $key = i18n_object_info('menu_link', 'key');
+ return i18n_string_translate(array('menu', 'item', $link[$key], 'description'), $link['options']['attributes']['title'], array('langcode' => $langcode));
}
else {
return NULL;
@@ -710,6 +714,26 @@ function i18n_menu_form_menu_edit_item_alter(&$form, &$form_state) {
}
/**
+ * Implements hook_form_FORM_ID_alter().
+ * FORM_ID = menu-overview-form.
+ * Add a "translate" link in operations column for each menu item.
+ */
+function i18n_menu_form_menu_overview_form_alter(&$form, &$form_state) {
+ foreach (element_children($form) as $element) {
+ if (substr($element, 0, 5) == 'mlid:') {
+ $mlid = $form[$element]['#item']['mlid'];
+ if (i18n_get_object('menu', $mlid)->get_translate_access()) {
+ $form[$element]['operations']['translate'] = array(
+ '#type' => 'link',
+ '#title' => t('translate'),
+ '#href' => "admin/structure/menu/item/{$mlid}/translate",
+ );
+ }
+ }
+ }
+}
+
+/**
* Normal path should be checked with menu item's language to avoid
* troubles when a node and it's translation has the same url alias.
*/
@@ -727,6 +751,9 @@ function i18n_menu_item_get_language($item) {
}
else {
$menu = menu_load($item['menu_name']);
+ if (!isset($menu['i18n_mode'])) {
+ return LANGUAGE_NONE;
+ }
switch ($menu['i18n_mode']) {
case I18N_MODE_LANGUAGE:
return $menu['language'];
@@ -859,6 +886,14 @@ function i18n_menu_link_load($path, $langcode) {
}
/**
+ * Implements hook_query_TAG_alter() for features_menu_links.
+ * Add needed fields to properly serialize localization information.
+ */
+function i18n_menu_query_features_menu_link_alter($query) {
+ $query->fields('menu_links', array('language', 'customized'));
+}
+
+/**
* Implements hook_init().
*/
function i18n_menu_init() {
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_node/i18n_node.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_node/i18n_node.info
index 56670fa..fe6bc65 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_node/i18n_node.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_node/i18n_node.info
@@ -9,9 +9,9 @@ configure = admin/config/regional/i18n/node
files[]=i18n_node.test
files[]=i18n_node.variable.inc
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_node/i18n_node.pages.inc b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_node/i18n_node.pages.inc
index 34cbe4b..a8adc7a 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_node/i18n_node.pages.inc
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_node/i18n_node.pages.inc
@@ -213,6 +213,7 @@ function i18n_node_select_translation_submit($form, &$form_state) {
))
->condition('nid', $add)
->execute();
+ entity_get_controller('node')->resetCache($add);
if (count($new)) {
drupal_set_message(format_plural(count($new), 'Added a node to the translation set.', 'Added @count nodes to the translation set.'));
}
@@ -224,6 +225,7 @@ function i18n_node_select_translation_submit($form, &$form_state) {
))
->condition('nid', $remove)
->execute();
+ entity_get_controller('node')->resetCache($remove);
drupal_set_message(format_plural(count($remove), 'Removed a node from the translation set.', 'Removed @count nodes from the translation set.'));
}
}
@@ -246,7 +248,7 @@ function i18n_node_autocomplete($type, $language, $string = '') {
*/
function i18n_node_nid2autocomplete($nid) {
if ($node = node_load($nid)) {
- return check_plain($node->title) . ' [nid:' . $nid . ']';
+ return $node->title . ' [nid:' . $nid . ']';
}
else {
return t('Not found');
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_path/i18n_path.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_path/i18n_path.info
index 33c0635..d5d919c 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_path/i18n_path.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_path/i18n_path.info
@@ -6,9 +6,9 @@ core = 7.x
files[] = i18n_path.inc
files[] = i18n_path.test
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_redirect/i18n_redirect.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_redirect/i18n_redirect.info
index 8149e51..d9e241f 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_redirect/i18n_redirect.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_redirect/i18n_redirect.info
@@ -4,9 +4,9 @@ dependencies[] = i18n
package = Multilingual - Internationalization
core = 7.x
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_select/i18n_select.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_select/i18n_select.info
index 8d84ef4..f695ee1 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_select/i18n_select.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_select/i18n_select.info
@@ -6,9 +6,9 @@ core = 7.x
configure = admin/config/regional/i18n/select
files[] = i18n_select.test
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.inc b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.inc
index 65f4c1b..3136aad 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.inc
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.inc
@@ -1188,6 +1188,10 @@ class i18n_string_object_wrapper extends i18n_object_wrapper {
* Translate access (localize strings)
*/
protected function localize_access() {
+ // We could check also whether the object has strings to translate:
+ // && $this->get_strings(array('empty' => TRUE))
+ // However it may be better to display the 'No available strings' message
+ // for the user to have a clue of what's going on. See i18n_string_translate_page_object()
return user_access('translate interface') && user_access('translate user-defined strings');
}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.info
index 7da968d..10a08e1 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.info
@@ -10,9 +10,9 @@ files[] = i18n_string.inc
files[] = i18n_string.test
configure = admin/config/regional/i18n/strings
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.pages.inc b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.pages.inc
index 86e7432..28005d6 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.pages.inc
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.pages.inc
@@ -12,7 +12,14 @@ include_once DRUPAL_ROOT . '/includes/locale.inc';
include_once drupal_get_path('module', 'locale') . '/locale.admin.inc';
/**
- * Generate translate page from object
+ * Generate translate page from object.
+ *
+ * @param string $object_type
+ * Obejct type as declared in hook_i18n_object_info().
+ * @param object $object_value
+ * Drupal object to translate.
+ * @param object $language
+ * Optional language object.
*/
function i18n_string_translate_page_object($object_type, $object_value, $language = NULL) {
// For backwards compatibility, ensure parameter is a language object
@@ -22,6 +29,13 @@ function i18n_string_translate_page_object($object_type, $object_value, $languag
$object = i18n_object($object_type, $object_value);
$strings = $object->get_strings(array('empty' => TRUE));
+ // If no localizable strings, print message and fail gracefully.
+ // Possibly this object comes from some other contrib module.
+ // See http://drupal.org/node/1889878
+ if (!$strings) {
+ return t('This object has no strings available for translation.');
+ }
+
if (empty($langcode)) {
drupal_set_title(t('Translate !name', array('!name' => i18n_object_info($object_type, 'title'))));
return i18n_string_translate_page_overview($object, $strings);
@@ -44,7 +58,6 @@ function i18n_string_translate_page_overview($object, $strings) {
* Provide a core translation module like overview page for this object.
*/
function i18n_string_translate_page_overview_form($form, &$form_state, $object, $strings) {
- //include_once DRUPAL_ROOT . '/includes/language.inc';
// Set the default item key, assume it's the first.
$item_title = reset($strings);
$header = array(
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_sync/i18n_sync.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_sync/i18n_sync.info
index 3d66753..1ad3ca9 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_sync/i18n_sync.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_sync/i18n_sync.info
@@ -10,9 +10,9 @@ files[] = i18n_sync.install
files[] = i18n_sync.module.inc
files[] = i18n_sync.node.inc
files[] = i18n_sync.test
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_sync/i18n_sync.node.inc b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_sync/i18n_sync.node.inc
index 0480eb7..b18c6f0 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_sync/i18n_sync.node.inc
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_sync/i18n_sync.node.inc
@@ -27,6 +27,7 @@
* Node operation (insert|update).
*/
function i18n_sync_node_translation($node, $translations, $field_names, $op) {
+ $total = count($translations);
$count = 0;
// Disable language selection and synchronization temporarily, enable it again later
$i18n_select = i18n_select(FALSE);
@@ -34,10 +35,11 @@ function i18n_sync_node_translation($node, $translations, $field_names, $op) {
foreach ($translations as $translation) {
// If translation is the same node, we cannot synchronize with itself
if ($node->nid == $translation->nid) {
+ $total--;
continue;
}
// Load full node, we need all data here.
- $translation = node_load($translation->nid, NULL, TRUE);
+ $translation = node_load($translation->nid);
$i18n_options = i18n_sync_node_options($node->type);
// Invoke callback for each field, the default is just copy over
foreach ($field_names as $field) {
@@ -53,6 +55,13 @@ function i18n_sync_node_translation($node, $translations, $field_names, $op) {
module_invoke_all('i18n_sync_translation', 'node', $translation, $translation->language, $node, $node->language, $field_names);
node_save($translation);
$count++;
+ // Flush each entity from the load cache after processing, to
+ // avoid exceeding PHP memory limits. It should be safe to keep
+ // at least one, however; so we retain the final translation in
+ // the cache after saving it.
+ if ($count < $total) {
+ entity_get_controller('node')->resetCache(array($translation->nid));
+ }
}
i18n_sync(TRUE);
i18n_select($i18n_select);
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.info
index 0d26403..3e7297b 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.info
@@ -11,9 +11,9 @@ files[] = i18n_taxonomy.pages.inc
files[] = i18n_taxonomy.admin.inc
files[] = i18n_taxonomy.test
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module
index d5c1793..0a051b2 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module
@@ -184,11 +184,11 @@ function i18n_taxonomy_field_formatter_info() {
}
/**
-- * Implements hook_field_formatter_prepare_view().
-- *
-- * This preloads all taxonomy terms for multiple loaded objects at once and
-- * unsets values for invalid terms that do not exist.
-- */
+ * Implements hook_field_formatter_prepare_view().
+ *
+ * This preloads all taxonomy terms for multiple loaded objects at once and
+ * unsets values for invalid terms that do not exist.
+ */
function i18n_taxonomy_field_formatter_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items, $displays) {
return taxonomy_field_formatter_prepare_view($entity_type, $entities, $field, $instances, $langcode, $items, $displays);
}
@@ -318,7 +318,7 @@ function i18n_taxonomy_field_storage_details_alter(&$details, &$field) {
/**
* Implements hook_field_attach_prepare_translation_alter().
-
+ *
* Prepare and synchronize translation for term reference fields.
*/
function i18n_taxonomy_field_attach_prepare_translation_alter(&$entity, $context) {
@@ -468,7 +468,8 @@ function i18n_taxonomy_theme() {
* Get localized term name unfiltered.
*/
function i18n_taxonomy_term_name($term, $langcode = NULL) {
- return i18n_taxonomy_vocabulary_mode($term->vid, I18N_MODE_LOCALIZE) ? i18n_string(array('taxonomy', 'term', $term->tid, 'name'), $term->name, array('langcode' => $langcode, 'sanitize' => FALSE)) : $term->name;
+ $key = i18n_object_info('taxonomy_term', 'key');
+ return i18n_taxonomy_vocabulary_mode($term->vid, I18N_MODE_LOCALIZE) ? i18n_string(array('taxonomy', 'term', $term->{$key}, 'name'), $term->name, array('langcode' => $langcode, 'sanitize' => FALSE)) : $term->name;
}
@@ -476,7 +477,8 @@ function i18n_taxonomy_term_name($term, $langcode = NULL) {
* Get localized term description unfiltered.
*/
function i18n_taxonomy_term_description($term, $langcode = NULL) {
- return i18n_taxonomy_vocabulary_mode($term->vid, I18N_MODE_LOCALIZE) ? i18n_string(array('taxonomy', 'term', $term->tid, 'description'), $term->description, array('langcode' => $langcode, 'sanitize' => FALSE)) : $term->description;
+ $key = i18n_object_info('taxonomy_term', 'key');
+ return i18n_taxonomy_vocabulary_mode($term->vid, I18N_MODE_LOCALIZE) ? i18n_string(array('taxonomy', 'term', $term->{$key}, 'description'), $term->description, array('langcode' => $langcode, 'sanitize' => FALSE)) : $term->description;
}
/**
@@ -1260,10 +1262,10 @@ function i18n_taxonomy_modules_enabled($modules) {
$modules = drupal_map_assoc($modules);
if (isset($modules['i18n_taxonomy'])) {
foreach (field_info_fields() as $fieldname => $field) {
- if ($field['type'] == 'taxonomy_term_reference') {
- $field['settings']['options_list_callback'] = 'i18n_taxonomy_allowed_values';
- field_update_field($field);
- }
+ if ($field['type'] == 'taxonomy_term_reference') {
+ $field['settings']['options_list_callback'] = 'i18n_taxonomy_allowed_values';
+ field_update_field($field);
}
+ }
}
}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_translation/i18n_translation.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_translation/i18n_translation.info
index b9b54e7..113bbe3 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_translation/i18n_translation.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_translation/i18n_translation.info
@@ -6,9 +6,9 @@ core = 7.x
files[] = i18n_translation.inc
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_user/i18n_user.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_user/i18n_user.info
index e438321..45ec115 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_user/i18n_user.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_user/i18n_user.info
@@ -4,9 +4,9 @@ core = 7.x
package = Multilingual - Internationalization
dependencies[] = i18n_variable
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_variable/i18n_variable.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_variable/i18n_variable.info
index 59a4674..4a57d30 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_variable/i18n_variable.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_variable/i18n_variable.info
@@ -10,9 +10,9 @@ configure = admin/config/regional/i18n/variable
files[] = i18n_variable.class.inc
files[] = i18n_variable.test
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/tests/i18n_test.info b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/tests/i18n_test.info
index f764aa0..af9f978 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/tests/i18n_test.info
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/tests/i18n_test.info
@@ -7,9 +7,9 @@ package = Testing
core = 6.x
hidden = TRUE
-; Information added by drupal.org packaging script on 2013-01-13
-version = "7.x-1.8"
+; Information added by drupal.org packaging script on 2013-08-21
+version = "7.x-1.10"
core = "7.x"
project = "i18n"
-datestamp = "1358075001"
+datestamp = "1377069696"