Browse Source

Update i18n 7.x-1.14

opi 8 years ago
parent
commit
c8479db649

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

@@ -8,9 +8,9 @@ files[] = i18n_object.inc
 files[] = i18n.test
 configure = admin/config/regional/i18n
 
-; Information added by Drupal.org packaging script on 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

+ 1 - 1
sites/all/modules/i18n/i18n.test

@@ -11,7 +11,7 @@ class Drupali18nTestCase extends DrupalWebTestCase {
 
   function setUpLanguages($admin_permissions = array()) {
     // Setup admin user.
-    $this->admin_user = $this->drupalCreateUser(array_merge(array('bypass node access', 'administer nodes', 'administer languages', 'administer content types', 'administer blocks', 'access administration pages', 'translate interface'), $admin_permissions));
+    $this->admin_user = $this->drupalCreateUser(array_merge(array('bypass node access', 'administer nodes', 'administer languages', 'administer content types', 'administer fields', 'administer blocks', 'access administration pages', 'translate interface'), $admin_permissions));
 
     $this->drupalLogin($this->admin_user);
 

+ 3 - 3
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 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

+ 3 - 3
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 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

+ 3 - 3
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 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

+ 3 - 3
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 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

+ 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.test
 
-; Information added by Drupal.org packaging script on 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

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

@@ -180,6 +180,7 @@ function i18n_menu_menu_link_alter(&$item) {
   // We just make sure every link has a valid language property.
   if (!i18n_object_langcode($item)) {
     $item['language'] = LANGUAGE_NONE;
+    $item['i18n_tsid'] = 0;
   }
 }
 
@@ -515,9 +516,11 @@ function _i18n_menu_link_description($link, $langcode = NULL) {
  * Check whether this link is to be processed by i18n_menu and start processing.
  */
 function _i18n_menu_link_process(&$link) {
-  // Only visible links that have a language property and haven't been processed
-  // before. We also check that they belong to a menu with language options.
-  if (empty($link['i18n_menu']) && !empty($link['language']) && !empty($link['access']) && empty($link['hidden']) && i18n_menu_mode($link['menu_name'])) {
+  // Only links that have a language property and haven't been processed before.
+  // We also translate links marked as hidden because core breadcrumbs ignore
+  // that flag and excluding them would basically interfere with core behaviour.
+  // We also check that they belong to a menu with language options.
+  if (empty($link['i18n_menu']) && !empty($link['language']) && !empty($link['access']) && i18n_menu_mode($link['menu_name'])) {
     // Mark so it won't be processed twice.
     $link['i18n_menu'] = TRUE;
     // Skip if administering this menu or this menu item.

+ 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.variable.inc
 
-; Information added by Drupal.org packaging script on 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

+ 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.test
-; Information added by Drupal.org packaging script on 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

+ 3 - 3
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 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

+ 3 - 3
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 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

+ 11 - 8
sites/all/modules/i18n/i18n_select/i18n_select.module

@@ -82,11 +82,11 @@ function i18n_select_mode($type = NULL) {
 }
 
 /**
- * Check current path to enable selection
+ * Check current path to enable selection.
  *
- * This works pretty much like block visibility
+ * This works pretty much like block visibility.
  *
- * @return boolean
+ * @return bool
  *   TRUE if content selection should be enabled for this page.
  */
 function i18n_select_page() {
@@ -100,8 +100,11 @@ function i18n_select_page() {
       // with different case. Ex: /Page, /page, /PAGE.
       $pages = drupal_strtolower($pages);
       if ($visibility < I18N_SELECT_PAGE_PHP) {
-        // Convert the Drupal path to lowercase
-        $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
+        // @see views_ajax()
+        // @see I18NSelectAdminViewsAjax::testViewsAjaxWithoutSkippingTags()
+        $path = isset($_REQUEST['view_path']) ? $_REQUEST['view_path'] : $_GET['q'];
+        // Convert the Drupal path to lowercase.
+        $path = drupal_strtolower(drupal_get_path_alias($path));
         // Compare the lowercase internal and lowercase path alias (if any).
         $page_match = drupal_match_path($path, $pages);
         if ($path != $_GET['q']) {
@@ -109,8 +112,8 @@ function i18n_select_page() {
         }
         // When $visibility has a value of 0 (I18N_SELECT_PAGE_NOTLISTED),
         // the block is displayed on all pages except those listed in $pages.
-        // When set to 1 (I18N_SELECT_PAGE_LISTED), it is displayed only on those
-        // pages listed in $pages.
+        // When set to 1 (I18N_SELECT_PAGE_LISTED), it is displayed only on
+        // those pages listed in $pages.
         $mode = !($visibility xor $page_match);
       }
       elseif (module_exists('php')) {
@@ -121,7 +124,7 @@ function i18n_select_page() {
       }
     }
     else {
-      // No pages defined, still respect the setting (unlike blocks)
+      // No pages defined, still respect the setting (unlike blocks).
       $mode = $visibility == I18N_SELECT_PAGE_NOTLISTED;
     }
   }

+ 84 - 0
sites/all/modules/i18n/i18n_select/i18n_select.test

@@ -84,3 +84,87 @@ class i18nSelectTestCase extends Drupali18nTestCase {
     }
   }
 }
+
+/**
+ * Test case for AJAX queries on "views/ajax" when view on admin page.
+ */
+class I18NSelectAdminViewsAjax extends Drupali18nTestCase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function getInfo() {
+    return array(
+      'name' => t('I18N select Admin Views (AJAX)'),
+      'group' => 'Internationalization',
+      'description' => t('Test AJAX requests to the "views/ajax" when view located on "admin/*" and list of skipping tags is empty.'),
+      // Skip this test when "admin_views" module does not exists.
+      'dependencies' => array('admin_views'),
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp('translation', 'i18n_variable', 'i18n_select', 'admin_views');
+    parent::setUpLanguages(array('access content overview'));
+    parent::setUpContentTranslation();
+  }
+
+  /**
+   * Test AJAX of a view without skipping tags for selection.
+   *
+   * @see i18n_select_page()
+   */
+  public function testViewsAjaxWithoutSkippingTags() {
+    // If this variable will have the "views" value then this test will not
+    // have sense. For instance, we want apply language selection filter
+    // for views and remove "views" from "i18n_select_skip_tags" variable.
+    // In this case all AJAX for views, on administration part of the site,
+    // will be broken because the "i18n_select_page()" function will work
+    // with "views/ajax" path instead of, for example, "admin/content".
+    variable_set('i18n_select_skip_tags', '');
+
+    // Create one hundred of nodes.
+    for ($i = 1; $i <= 100; $i++) {
+      // Create every second node on Spanish language and
+      // every first - on English.
+      $node = $this->createNode('page', "Node $i", '', $i % 2 ? $this->default_language : $this->secondary_language);
+
+      // Update "changed" in order to sort the content by updating date. In
+      // other case all nodes will be with the same date and not arranged in
+      // order.
+      db_update('node')
+        ->fields(array('changed' => strtotime("+ $i minute")))
+        ->condition('nid', $node->nid)
+        ->execute();
+    }
+
+    $this->drupalGet('admin/content');
+
+    // Check that latest node exists at the top.
+    $this->assertText('Node 100');
+    // Check that our page contains fifty nodes (the latest must be 51).
+    $this->assertNoText('Node 50');
+
+    // Test $_REQUEST['view_path']. There's no form to submit to, so
+    // drupalPost() won't work here. This just tests a direct $_POST
+    // request instead.
+    $this->curlExec(array(
+      CURLOPT_URL => $this->getAbsoluteUrl('views/ajax'),
+      CURLOPT_POST => TRUE,
+      CURLOPT_POSTFIELDS => http_build_query(array(
+        'page' => 1,
+        'view_path' => 'admin/content',
+        'view_name' => 'admin_views_node',
+        'view_display_id' => 'system_1',
+      )),
+    ));
+
+    // Check that we are successfully switched to a new page of content.
+    $this->assertText('Node 50');
+    $this->assertNoText('Node 100');
+  }
+
+}

+ 3 - 3
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 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

+ 3 - 3
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 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

+ 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.test
 
-; Information added by Drupal.org packaging script on 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

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

@@ -213,7 +213,12 @@ function i18n_taxonomy_field_formatter_view($entity_type, $entity, $field, $inst
           );
         }
         else {
-          $term = $item['taxonomy_term'];
+          if (isset($item['taxonomy_term'])) {
+            $term = $item['taxonomy_term'];
+          }
+          else {
+            $term = taxonomy_term_load($item['tid']);
+          }
           $uri = entity_uri('taxonomy_term', $term);
           $element[$delta] = array(
             '#type' => 'link',
@@ -1020,6 +1025,10 @@ function i18n_taxonomy_localize_terms($terms) {
   if (!i18n_string_translate_langcode()) {
     return $terms;
   }
+  // $terms is not a valid array or term.
+  if (empty($terms)) {
+    return $terms;
+  }
   $object_info = i18n_object_info('taxonomy_term');
   $list = is_array($terms) ? $terms : array($terms);
   foreach ($list as $index => $term) {

+ 3 - 3
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 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

+ 3 - 3
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 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

+ 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.test
 
-; Information added by Drupal.org packaging script on 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"
 

+ 3 - 3
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 2015-05-07
-version = "7.x-1.13"
+; Information added by Drupal.org packaging script on 2016-10-22
+version = "7.x-1.14"
 core = "7.x"
 project = "i18n"
-datestamp = "1430999922"
+datestamp = "1477154943"