Browse Source

[up] i18n 7.x-1.17

opi 8 years ago
parent
commit
f7cda71939
30 changed files with 187 additions and 84 deletions
  1. 1 1
      sites/all/modules/i18n/README.txt
  2. 3 3
      sites/all/modules/i18n/i18n.info
  3. 3 3
      sites/all/modules/i18n/i18n_block/i18n_block.info
  4. 3 2
      sites/all/modules/i18n/i18n_block/i18n_block.test
  5. 3 3
      sites/all/modules/i18n/i18n_contact/i18n_contact.info
  6. 3 3
      sites/all/modules/i18n/i18n_field/i18n_field.info
  7. 3 3
      sites/all/modules/i18n/i18n_forum/i18n_forum.info
  8. 3 3
      sites/all/modules/i18n/i18n_menu/i18n_menu.info
  9. 2 3
      sites/all/modules/i18n/i18n_menu/i18n_menu.module
  10. 3 3
      sites/all/modules/i18n/i18n_node/i18n_node.info
  11. 19 2
      sites/all/modules/i18n/i18n_node/i18n_node.module
  12. 18 1
      sites/all/modules/i18n/i18n_node/i18n_node.variable.inc
  13. 3 3
      sites/all/modules/i18n/i18n_path/i18n_path.info
  14. 3 3
      sites/all/modules/i18n/i18n_redirect/i18n_redirect.info
  15. 3 3
      sites/all/modules/i18n/i18n_select/i18n_select.info
  16. 8 1
      sites/all/modules/i18n/i18n_string/i18n_string.inc
  17. 3 3
      sites/all/modules/i18n/i18n_string/i18n_string.info
  18. 42 5
      sites/all/modules/i18n/i18n_string/i18n_string.module
  19. 28 12
      sites/all/modules/i18n/i18n_string/i18n_string.pages.inc
  20. 1 1
      sites/all/modules/i18n/i18n_sync/README.txt
  21. 4 4
      sites/all/modules/i18n/i18n_sync/i18n_sync.info
  22. 1 1
      sites/all/modules/i18n/i18n_sync/i18n_sync.module
  23. 1 1
      sites/all/modules/i18n/i18n_sync/i18n_sync.node.inc
  24. 3 3
      sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.info
  25. 10 1
      sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module
  26. 3 3
      sites/all/modules/i18n/i18n_translation/i18n_translation.info
  27. 1 1
      sites/all/modules/i18n/i18n_translation/i18n_translation.module
  28. 3 3
      sites/all/modules/i18n/i18n_user/i18n_user.info
  29. 3 3
      sites/all/modules/i18n/i18n_variable/i18n_variable.info
  30. 3 3
      sites/all/modules/i18n/tests/i18n_test.info

+ 1 - 1
sites/all/modules/i18n/README.txt

@@ -20,7 +20,7 @@ For support, please create a support request for this module's project:
 
 
 Support questions by email to the module maintainer will be simply ignored. Use the issue tracker.
 Support questions by email to the module maintainer will be simply ignored. Use the issue tracker.
 
 
-Now if you want professional (paid) support the module maintainer may be available occassionally.
+Now if you want professional (paid) support the module maintainer may be available occasionally.
 Drop me a message to check availability and hourly rates, http://reyero.net/en/contact
 Drop me a message to check availability and hourly rates, http://reyero.net/en/contact
 
 
 ====================================================================
 ====================================================================

+ 3 - 3
sites/all/modules/i18n/i18n.info

@@ -8,9 +8,9 @@ files[] = i18n_object.inc
 files[] = i18n.test
 files[] = i18n.test
 configure = admin/config/regional/i18n
 configure = admin/config/regional/i18n
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 3 - 3
sites/all/modules/i18n/i18n_block/i18n_block.info

@@ -8,9 +8,9 @@ files[] = i18n_block.inc
 files[] = i18n_block.test
 files[] = i18n_block.test
 
 
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 3 - 2
sites/all/modules/i18n/i18n_block/i18n_block.test

@@ -72,15 +72,16 @@ class i18nBlocksTestCase extends Drupali18nTestCase {
 
 
     $this->clickLink(t('translate'));
     $this->clickLink(t('translate'));
 
 
+    // Title is a textarea, body is a text_format.
     $this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':title]', $translations['title']['es']);
     $this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':title]', $translations['title']['es']);
-    $this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':body]', $translations['body']['es']);
+    $this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':body][value]', $translations['body']['es']);
 
 
     // Update the translation.
     // Update the translation.
     $translations['title']['es'] = $this->randomName(10);
     $translations['title']['es'] = $this->randomName(10);
     $translations['body']['es'] = $this->randomName(20);
     $translations['body']['es'] = $this->randomName(20);
     $edit = array(
     $edit = array(
       'strings[blocks:block:' . $box2['delta'] . ':title]' => $translations['title']['es'],
       'strings[blocks:block:' . $box2['delta'] . ':title]' => $translations['title']['es'],
-      'strings[blocks:block:' . $box2['delta'] . ':body]' => $translations['body']['es'],
+      'strings[blocks:block:' . $box2['delta'] . ':body][value]' => $translations['body']['es'],
     );
     );
     $this->drupalPost(NULL, $edit, t('Save translation'));
     $this->drupalPost(NULL, $edit, t('Save translation'));
     $this->i18nAssertTranslations($translations['title'], '', 'Updated block title translation displayed.');
     $this->i18nAssertTranslations($translations['title'], '', 'Updated block title translation displayed.');

+ 3 - 3
sites/all/modules/i18n/i18n_contact/i18n_contact.info

@@ -5,9 +5,9 @@ dependencies[] = i18n_string
 package = Multilingual - Internationalization
 package = Multilingual - Internationalization
 core = 7.x
 core = 7.x
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 3 - 3
sites/all/modules/i18n/i18n_field/i18n_field.info

@@ -6,9 +6,9 @@ package = Multilingual - Internationalization
 core = 7.x
 core = 7.x
 files[] = i18n_field.inc
 files[] = i18n_field.inc
 files[] = i18n_field.test
 files[] = i18n_field.test
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 3 - 3
sites/all/modules/i18n/i18n_forum/i18n_forum.info

@@ -7,9 +7,9 @@ package = Multilingual - Internationalization
 core = 7.x
 core = 7.x
 files[] = i18n_forum.test
 files[] = i18n_forum.test
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 3 - 3
sites/all/modules/i18n/i18n_menu/i18n_menu.info

@@ -10,9 +10,9 @@ core = 7.x
 files[] = i18n_menu.inc
 files[] = i18n_menu.inc
 files[] = i18n_menu.test
 files[] = i18n_menu.test
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 2 - 3
sites/all/modules/i18n/i18n_menu/i18n_menu.module

@@ -198,7 +198,6 @@ function i18n_menu_menu_link_alter(&$item) {
   // We just make sure every link has a valid language property.
   // We just make sure every link has a valid language property.
   if (!i18n_object_langcode($item)) {
   if (!i18n_object_langcode($item)) {
     $item['language'] = LANGUAGE_NONE;
     $item['language'] = LANGUAGE_NONE;
-    $item['i18n_tsid'] = 0;
   }
   }
 }
 }
 
 
@@ -398,7 +397,7 @@ function i18n_menu_localize_tree($tree, $langcode = NULL) {
     if (_i18n_menu_link_process($item['link'])) {
     if (_i18n_menu_link_process($item['link'])) {
       if (!_i18n_menu_link_is_visible($item['link'], $langcode)) {
       if (!_i18n_menu_link_is_visible($item['link'], $langcode)) {
         // Remove links for other languages than current.
         // Remove links for other languages than current.
-        // Links with language wont be localized.
+        // Links with language won't be localized.
         unset($tree[$index]);
         unset($tree[$index]);
         // @todo Research whether the above has any advantage over:
         // @todo Research whether the above has any advantage over:
         // $item['hidden'] = TRUE;
         // $item['hidden'] = TRUE;
@@ -600,7 +599,7 @@ function _i18n_menu_link_is_visible($link, $langcode = NULL) {
 }
 }
 
 
 /**
 /**
- * Get localizable properties for menu link checking agains the router item.
+ * Get localizable properties for menu link checking against the router item.
  */
  */
 function _i18n_menu_link_localizable_properties($link) {
 function _i18n_menu_link_localizable_properties($link) {
   $props = array();
   $props = array();

+ 3 - 3
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.test
 files[]=i18n_node.variable.inc
 files[]=i18n_node.variable.inc
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 19 - 2
sites/all/modules/i18n/i18n_node/i18n_node.module

@@ -222,8 +222,16 @@ function i18n_node_language_mode($type) {
 function i18n_node_node_prepare($node) {
 function i18n_node_node_prepare($node) {
   $options = variable_get('i18n_node_options_' . $node->type, array());
   $options = variable_get('i18n_node_options_' . $node->type, array());
   if (i18n_node_type_enabled($node) && empty($node->nid) && !i18n_object_langcode($node) && in_array('current', $options)) {
   if (i18n_node_type_enabled($node) && empty($node->nid) && !i18n_object_langcode($node) && in_array('current', $options)) {
+    $default = variable_get('i18n_node_default_language_for_' . $node->type, '-- current --');
+
     // Set current language for new nodes if option enabled
     // Set current language for new nodes if option enabled
-    $node->language = i18n_language_content()->language;
+    if ($default === '-- current --') {
+      $node->language = i18n_language_content()->language;
+    }
+    // If a custom language was specified, apply it.
+    else {
+      $node->language = $default;
+    }
   }
   }
 }
 }
 
 
@@ -417,7 +425,16 @@ function i18n_node_form_node_type_form_alter(&$form, &$form_state) {
     // Some settings about node languages. Add variables for node type from variable definition
     // Some settings about node languages. Add variables for node type from variable definition
     if ($form['#node_type']->type) {
     if ($form['#node_type']->type) {
       variable_type_include('node_type');
       variable_type_include('node_type');
-      $form['i18n'] += node_variable_type_subform($form['#node_type']->type, array('i18n_node_options', 'i18n_node_extended'));
+      $form['i18n'] += node_variable_type_subform($form['#node_type']->type, array('i18n_node_options', 'i18n_node_default_language_for', 'i18n_node_extended'));
+      // Only show custom default language field if "current" is checked.
+      $form['i18n']['i18n_node_default_language_for']['#states'] = array(
+        'visible' => array(
+          ':input[name="i18n_node_options[current]"]' => array('checked' => TRUE),
+        ),
+        'required' => array(
+          ':input[name="i18n_node_options[current]"]' => array('checked' => TRUE),
+        ),
+      );
     }
     }
     // Add disabled message
     // Add disabled message
     if ($disabled) {
     if ($disabled) {

+ 18 - 1
sites/all/modules/i18n/i18n_node/i18n_node.variable.inc

@@ -45,13 +45,30 @@ function i18n_node_variable_info($options = array()) {
     'repeat' => array(
     'repeat' => array(
       'type' => 'options',
       'type' => 'options',
       'options' => array(
       'options' => array(
-        'current' => t('Set current language as default for new content.', array(), $options),
+        // Note: this was previously used only to mark new, translatable nodes
+        // with the current language of the user. Now, this setting is extended
+        // to allow a specific language to be chosen (defaulting to the current
+        // language). This was done for backwards compatibility reasons.
+        'current' => t('Set custom language as default for new content.', array(), $options),
         'required' => t('Require language (Do not allow Language Neutral).', array(), $options),
         'required' => t('Require language (Do not allow Language Neutral).', array(), $options),
         'lock' => t('Lock language (Cannot be changed).', array(), $options),
         'lock' => t('Lock language (Cannot be changed).', array(), $options),
       ),
       ),
     ),
     ),
     'group' => 'i18n',
     'group' => 'i18n',
   );
   );
+  // This field will only be displayed if "current" is checked above.
+  $variables['i18n_node_default_language_for_[node_type]'] = array(
+    'type' => 'multiple',
+    'title' => t('Custom default language', array(), $options),
+    'repeat' => array(
+      'type' => 'select',
+      'options' => array_merge(array(
+        '-- current --' => t('Current language')
+      ), locale_language_list('name')),
+      'default' => '-- current --',
+    ),
+    'group' => 'i18n',
+  );
   $variables['i18n_node_extended_[node_type]'] = array(
   $variables['i18n_node_extended_[node_type]'] = array(
     'type' => 'multiple',
     'type' => 'multiple',
     'title' => t('Extended language support'),
     'title' => t('Extended language support'),

+ 3 - 3
sites/all/modules/i18n/i18n_path/i18n_path.info

@@ -6,9 +6,9 @@ core = 7.x
 
 
 files[] = i18n_path.inc
 files[] = i18n_path.inc
 files[] = i18n_path.test
 files[] = i18n_path.test
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 3 - 3
sites/all/modules/i18n/i18n_redirect/i18n_redirect.info

@@ -4,9 +4,9 @@ dependencies[] = i18n
 package = Multilingual - Internationalization
 package = Multilingual - Internationalization
 core = 7.x
 core = 7.x
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 3 - 3
sites/all/modules/i18n/i18n_select/i18n_select.info

@@ -6,9 +6,9 @@ core = 7.x
 configure = admin/config/regional/i18n/select
 configure = admin/config/regional/i18n/select
 files[] = i18n_select.test
 files[] = i18n_select.test
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 8 - 1
sites/all/modules/i18n/i18n_string/i18n_string.inc

@@ -1166,10 +1166,17 @@ class i18n_string_object_wrapper extends i18n_object_wrapper {
       $info = is_array($info) ? $info : array('title' => $info);
       $info = is_array($info) ? $info : array('title' => $info);
       $field_name = isset($info['field']) ? $info['field'] : $field;
       $field_name = isset($info['field']) ? $info['field'] : $field;
       $value = $this->get_field($field_name);
       $value = $this->get_field($field_name);
+      if (is_array($value) && isset($value['value'])) {
+        $format = isset($value['format']) ? $value['format'] : NULL;
+        $value = $value['value'];
+      }
+      else {
+        $format = isset($info['format']) ? $this->get_field($info['format']) : NULL;
+      }
       $strings[$this->get_textgroup()][$string_type][$object_id][$field] = array(
       $strings[$this->get_textgroup()][$string_type][$object_id][$field] = array(
         'string' => is_array($value) || isset($info['empty']) && $value === $info['empty'] ? NULL : $value,
         'string' => is_array($value) || isset($info['empty']) && $value === $info['empty'] ? NULL : $value,
         'title' => $info['title'],
         'title' => $info['title'],
-        'format' => isset($info['format']) ? $this->get_field($info['format']) : NULL,
+        'format' => $format,
         'name' => array_merge($object_keys, array($field)),
         'name' => array_merge($object_keys, array($field)),
       );
       );
     }
     }

+ 3 - 3
sites/all/modules/i18n/i18n_string/i18n_string.info

@@ -10,9 +10,9 @@ files[] = i18n_string.inc
 files[] = i18n_string.test
 files[] = i18n_string.test
 configure = admin/config/regional/i18n/strings
 configure = admin/config/regional/i18n/strings
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 42 - 5
sites/all/modules/i18n/i18n_string/i18n_string.module

@@ -259,6 +259,34 @@ function i18n_string_locale_translate_import_form_submit($form, &$form_state) {
 }
 }
 
 
 /**
 /**
+ * Implements hook_element_info_alter().
+ *
+ * We need to do this on the element info level as wysiwyg also does so and form
+ * API (incorrectly) does not merge in the defaults for values that are arrays.
+ */
+function i18n_string_element_info_alter(&$types) {
+  $types['text_format']['#pre_render'][] = 'i18n_string_pre_render_text_format';
+}
+
+/**
+ * The '#pre_render' function to alter the text format element in a translation.
+ * The text format for a translation is taken form the original, so the text
+ * format drop down should be disabled.
+ *
+ * @param array $element
+ *   The text_format element which will be rendered.
+ *
+ * @return array
+ *   The altered text_format element with a disabled "Text format" select.
+ */
+function i18n_string_pre_render_text_format($element) {
+  if (!empty($element['#i18n_string_is_translation'])) {
+      $element['format']['format']['#attributes']['disabled'] = TRUE;
+  }
+  return $element;
+}
+
+/**
  * Check if translation is required for this language code.
  * Check if translation is required for this language code.
  *
  *
  * Translation is required when default language is different from the given
  * Translation is required when default language is different from the given
@@ -334,7 +362,10 @@ function i18n_string_update_context($oldname, $newname) {
 }
 }
 
 
 /**
 /**
- * Get textgroup handler
+ * Get textgroup handler.
+ *
+ * @return i18n_string_textgroup_default
+ *
  */
  */
 function i18n_string_textgroup($textgroup) {
 function i18n_string_textgroup($textgroup) {
   $groups = &drupal_static(__FUNCTION__);
   $groups = &drupal_static(__FUNCTION__);
@@ -519,11 +550,12 @@ function i18n_string_multiple($operation, $name, $strings, $options = array()) {
  *
  *
  * This function is intended to return translations for plain strings that have NO text format
  * This function is intended to return translations for plain strings that have NO text format
  *
  *
- * @param $name
+ * @param array|string name
  *   Array or string concatenated with ':' that contains textgroup and string context
  *   Array or string concatenated with ':' that contains textgroup and string context
- * @param $string
- *   String in default language or array of strings to be translated
- * @param $options
+ * @param array|string $string
+ *   A string in the default language, a string wth format (array with keys
+ *   value and format),or an array of strings (without format) to be translated.
+ * @param array $options
  *   An associative array of additional options, with the following keys:
  *   An associative array of additional options, with the following keys:
  *   - 'langcode' (defaults to the current language) The language code to translate to a language other than what is used to display the page.
  *   - 'langcode' (defaults to the current language) The language code to translate to a language other than what is used to display the page.
  *   - 'filter' Filtering callback to apply to the translated string only
  *   - 'filter' Filtering callback to apply to the translated string only
@@ -531,8 +563,13 @@ function i18n_string_multiple($operation, $name, $strings, $options = array()) {
  *   - 'callback' Callback to apply to the result (both to translated or untranslated string
  *   - 'callback' Callback to apply to the result (both to translated or untranslated string
  *   - 'sanitize' Whether to filter the translation applying the text format if any, default is TRUE
  *   - 'sanitize' Whether to filter the translation applying the text format if any, default is TRUE
  *   - 'sanitize default' Whether to filter the default value if no translation found, default is FALSE
  *   - 'sanitize default' Whether to filter the default value if no translation found, default is FALSE
+ *
+ * @return string
  */
  */
 function i18n_string_translate($name, $string, $options = array()) {
 function i18n_string_translate($name, $string, $options = array()) {
+  if (is_array($string) && isset($string['value'])) {
+    $string = $string['value'];
+  }
   if (is_array($string)) {
   if (is_array($string)) {
     return i18n_string_translate_list($name, $string, $options);
     return i18n_string_translate_list($name, $string, $options);
   }
   }

+ 28 - 12
sites/all/modules/i18n/i18n_string/i18n_string.pages.inc

@@ -170,14 +170,16 @@ function i18n_string_translate_page_form_base($form, $langcode, $redirect = NULL
 
 
 /**
 /**
  * Create field elements for strings
  * Create field elements for strings
+ *
+ * @param i18n_string_object[] $strings
+ * @param string $langcode
+ *
+ * @return array
  */
  */
 function i18n_string_translate_page_form_strings($strings, $langcode) {
 function i18n_string_translate_page_form_strings($strings, $langcode) {
-  $formats = filter_formats();
+  global $user;
+  $form = array();
   foreach ($strings as $item) {
   foreach ($strings as $item) {
-    // We may have a source or not. Load it, our string may get the format from it.
-    $source = $item->get_source();
-    $format_id = $source ? $source->format : $item->format;
-    $description = '';
     // Check permissions to translate this string, depends on format, etc..
     // Check permissions to translate this string, depends on format, etc..
     if ($message = $item->check_translate_access()) {
     if ($message = $item->check_translate_access()) {
       // We'll display a disabled element with the reason it cannot be translated.
       // We'll display a disabled element with the reason it cannot be translated.
@@ -188,27 +190,31 @@ function i18n_string_translate_page_form_strings($strings, $langcode) {
       $disabled = FALSE;
       $disabled = FALSE;
       $description = '';
       $description = '';
       // If we don't have a source and it can be translated, we create it.
       // If we don't have a source and it can be translated, we create it.
-      if (!$source) {
+      if (!$item->get_source()) {
         // Enable messages just as a reminder these strings are not being updated properly.
         // Enable messages just as a reminder these strings are not being updated properly.
         $status = $item->update(array('messages' => TRUE));
         $status = $item->update(array('messages' => TRUE));
         if ($status === FALSE || $status === SAVED_DELETED) {
         if ($status === FALSE || $status === SAVED_DELETED) {
           // We don't have a source string so nothing to translate here
           // We don't have a source string so nothing to translate here
           $disabled = TRUE;
           $disabled = TRUE;
         }
         }
-        else {
-          $source = $item->get_source();
-        }
       }
       }
     }
     }
 
 
     $default_value = $item->format_translation($langcode, array('langcode' => $langcode, 'sanitize' => FALSE, 'debug' => FALSE));
     $default_value = $item->format_translation($langcode, array('langcode' => $langcode, 'sanitize' => FALSE, 'debug' => FALSE));
+    $available_formats = array_keys(filter_formats($user));
+    if (!in_array($item->format, $available_formats)) {
+      $item->format = NULL;
+    }
     $form[$item->get_name()] = array(
     $form[$item->get_name()] = array(
       '#title' => $item->get_title(),
       '#title' => $item->get_title(),
-      '#type' => 'textarea',
+      '#type' => $item->format ? 'text_format' : 'textarea',
       '#default_value' => $default_value,
       '#default_value' => $default_value,
+      '#format' => $item->format,
+      // This will trigger i18n_string_pre_render_text_format() to actually
+      // alter the element.
+      '#i18n_string_is_translation' => TRUE,
       '#disabled' => $disabled,
       '#disabled' => $disabled,
-      '#description' => $description . _i18n_string_translate_format_help($format_id),
-      //'#i18n_string_format' => $source ? $source->format : 0,
+      '#description' => $description,
       // If disabled, provide smaller textarea (that can be expanded anyway).
       // If disabled, provide smaller textarea (that can be expanded anyway).
       '#rows' => $disabled ? 1 : min(ceil(str_word_count($default_value) / 12), 10),
       '#rows' => $disabled ? 1 : min(ceil(str_word_count($default_value) / 12), 10),
       // Change the parent for disabled strings so we don't get empty values later
       // Change the parent for disabled strings so we don't get empty values later
@@ -226,6 +232,16 @@ function i18n_string_translate_page_form_submit($form, &$form_state) {
   foreach ($form_state['values']['strings'] as $name => $value) {
   foreach ($form_state['values']['strings'] as $name => $value) {
     $count++;
     $count++;
     list($textgroup, $context) = i18n_string_context(explode(':', $name));
     list($textgroup, $context) = i18n_string_context(explode(':', $name));
+    if (is_array($value)) {
+      if (isset($value['value'])) {
+        $value = $value['value'];
+        $form_state['values']['strings'][$name] = $value;
+      }
+      else {
+        form_set_error("strings][$name", t('Unable to get the translated string value.'));
+        watchdog('locale', 'Unable to get the translated string value, string array is: %string', array('%string' => var_dump($value)), WATCHDOG_WARNING);
+      }
+    }
     $result = i18n_string_textgroup($textgroup)->update_translation($context, $form_state['values']['langcode'], $value);
     $result = i18n_string_textgroup($textgroup)->update_translation($context, $form_state['values']['langcode'], $value);
     $success += ($result ? 1 : 0);
     $success += ($result ? 1 : 0);
   }
   }

+ 1 - 1
sites/all/modules/i18n/i18n_sync/README.txt

@@ -3,7 +3,7 @@ README.txt
 ==========
 ==========
 Drupal module: i18n_sync (Synchronization)
 Drupal module: i18n_sync (Synchronization)
 
 
-This module will handle content synchronization accross translations.
+This module will handle content synchronization across translations.
 
 
 The available list of fields to synchronize will include standard node fields and cck fields.
 The available list of fields to synchronize will include standard node fields and cck fields.
 To have aditional fields, add the list in a variable in the settings.php file, like this:
 To have aditional fields, add the list in a variable in the settings.php file, like this:

+ 4 - 4
sites/all/modules/i18n/i18n_sync/i18n_sync.info

@@ -1,5 +1,5 @@
 name = Synchronize translations
 name = Synchronize translations
-description = Synchronizes taxonomy and fields accross translations of the same content.
+description = Synchronizes taxonomy and fields across translations of the same content.
 dependencies[] = i18n
 dependencies[] = i18n
 dependencies[] = translation
 dependencies[] = translation
 package = Multilingual - Internationalization
 package = Multilingual - Internationalization
@@ -10,9 +10,9 @@ files[] = i18n_sync.install
 files[] = i18n_sync.module.inc
 files[] = i18n_sync.module.inc
 files[] = i18n_sync.node.inc
 files[] = i18n_sync.node.inc
 files[] = i18n_sync.test
 files[] = i18n_sync.test
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 1 - 1
sites/all/modules/i18n/i18n_sync/i18n_sync.module

@@ -33,7 +33,7 @@ function i18n_sync($status = NULL) {
 function i18n_sync_help($path, $arg) {
 function i18n_sync_help($path, $arg) {
   switch ($path) {
   switch ($path) {
     case 'admin/help#i18n_sync' :
     case 'admin/help#i18n_sync' :
-      $output = '<p>' . t('This module synchronizes content taxonomy and fields accross translations:') . '</p>';
+      $output = '<p>' . t('This module synchronizes content taxonomy and fields across translations:') . '</p>';
       $output .= '<p>' . t('First you need to select which fields should be synchronized. Then, after a node has been updated, all enabled vocabularies and fields will be synchronized as follows:') . '</p>';
       $output .= '<p>' . t('First you need to select which fields should be synchronized. Then, after a node has been updated, all enabled vocabularies and fields will be synchronized as follows:') . '</p>';
       $output .= '<ul>';
       $output .= '<ul>';
       $output .= '<li>' . t('All the node fields selected for synchronization will be set to the same value for all translations.') . '</li>';
       $output .= '<li>' . t('All the node fields selected for synchronization will be set to the same value for all translations.') . '</li>';

+ 1 - 1
sites/all/modules/i18n/i18n_sync/i18n_sync.node.inc

@@ -98,7 +98,7 @@ function i18n_sync_node_translation_nodereference_field(&$node, &$translation, $
  * Example:
  * Example:
  *   English A references English B and English C.
  *   English A references English B and English C.
  *   English A and B are translated to German A and B, but English C is not.
  *   English A and B are translated to German A and B, but English C is not.
- *   The syncronization from English A to German A would it German B and English C.
+ *   The synchronization from English A to German A would it German B and English C.
  */
  */
 function i18n_sync_node_translation_reference_field(&$reference_node, $default_value, $langcode) {
 function i18n_sync_node_translation_reference_field(&$reference_node, $default_value, $langcode) {
   if (isset($reference_node->tnid) && translation_supported_type($reference_node->type)) {
   if (isset($reference_node->tnid) && translation_supported_type($reference_node->type)) {

+ 3 - 3
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.admin.inc
 files[] = i18n_taxonomy.test
 files[] = i18n_taxonomy.test
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 10 - 1
sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module

@@ -377,10 +377,19 @@ function i18n_taxonomy_field_prepare_translation($entity_type, $entity, $field,
  *   The array of valid terms for this field, keyed by term id.
  *   The array of valid terms for this field, keyed by term id.
  */
  */
 function i18n_taxonomy_allowed_values($field) {
 function i18n_taxonomy_allowed_values($field) {
+  global $language;
   $options = array();
   $options = array();
   foreach ($field['settings']['allowed_values'] as $tree) {
   foreach ($field['settings']['allowed_values'] as $tree) {
     if ($vocabulary = taxonomy_vocabulary_machine_name_load($tree['vocabulary'])) {
     if ($vocabulary = taxonomy_vocabulary_machine_name_load($tree['vocabulary'])) {
-      if ($terms = taxonomy_get_tree($vocabulary->vid, $tree['parent'])) {
+      if (i18n_taxonomy_vocabulary_mode($vocabulary->vid) == I18N_MODE_TRANSLATE) {
+        $parent = i18n_taxonomy_translation_term_tid($tree['parent'], NULL, $tree['parent']);
+        $language = i18n_language_context();
+        $terms = i18n_taxonomy_get_tree($vocabulary->vid, $language->language, $parent);
+      }
+      else {
+        $terms = taxonomy_get_tree($vocabulary->vid, $tree['parent']);
+      }
+      if ($terms) {
         foreach ($terms as $term) {
         foreach ($terms as $term) {
           $options[$term->tid] = str_repeat('-', $term->depth) . i18n_taxonomy_term_name($term);
           $options[$term->tid] = str_repeat('-', $term->depth) . i18n_taxonomy_term_name($term);
         }
         }

+ 3 - 3
sites/all/modules/i18n/i18n_translation/i18n_translation.info

@@ -6,9 +6,9 @@ core = 7.x
 
 
 files[] = i18n_translation.inc
 files[] = i18n_translation.inc
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 1 - 1
sites/all/modules/i18n/i18n_translation/i18n_translation.module

@@ -20,7 +20,7 @@ class I18nTranslationSetController extends DrupalDefaultEntityController {
    * @param $queried_entities
    * @param $queried_entities
    *   Associative array of query results, keyed on the entity ID.
    *   Associative array of query results, keyed on the entity ID.
    * @param $revision_id
    * @param $revision_id
-   *   ID of the revision that was loaded, or FALSE if teh most current revision
+   *   ID of the revision that was loaded, or FALSE if the most current revision
    *   was loaded.
    *   was loaded.
    */
    */
   protected function attachLoad(&$queried_entities, $revision_id = FALSE) {
   protected function attachLoad(&$queried_entities, $revision_id = FALSE) {

+ 3 - 3
sites/all/modules/i18n/i18n_user/i18n_user.info

@@ -4,9 +4,9 @@ core = 7.x
 package = Multilingual - Internationalization
 package = Multilingual - Internationalization
 dependencies[] = i18n_variable
 dependencies[] = i18n_variable
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 3 - 3
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.class.inc
 files[] = i18n_variable.test
 files[] = i18n_variable.test
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"
 
 

+ 3 - 3
sites/all/modules/i18n/tests/i18n_test.info

@@ -7,9 +7,9 @@ package = Testing
 core = 6.x
 core = 6.x
 hidden = TRUE
 hidden = TRUE
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2017-04-18
+version = "7.x-1.17"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
+datestamp = "1492537747"