Index: potx.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/potx/Attic/potx.inc,v
retrieving revision 1.1.2.17.2.7.2.19.4.13
diff -u -p -r1.1.2.17.2.7.2.19.4.13 potx.inc
--- potx.inc	7 May 2010 14:57:30 -0000	1.1.2.17.2.7.2.19.4.13
+++ potx.inc	25 Jan 2011 10:01:08 -0000
@@ -219,7 +219,7 @@ function _potx_process_file($file_path, 
       _potx_find_perm_hook($file_name, $name_parts['filename'], $save_callback);
     }
     if ($api_version > POTX_API_5) {
-      _potx_find_menu_hook($file_name, $name_parts['filename'], $save_callback);
+      _potx_find_menu_hooks($file_name, $name_parts['filename'], $save_callback);
     }
   }
 
@@ -1083,32 +1083,57 @@ function _potx_find_context($tf, $ti, $f
  * @param $save_callback
  *   Callback function used to save strings.
  */
-function _potx_find_menu_hook($file, $filebase, $save_callback) {
+function _potx_find_menu_hooks($file, $filebase, $save_callback) {
   global $_potx_tokens, $_potx_lookup;
 
-  if (isset($_potx_lookup[$filebase .'_menu']) && is_array($_potx_lookup[$filebase .'_menu'])) {
-    // We have a menu hook in this file.
-    foreach ($_potx_lookup[$filebase .'_menu'] as $ti) {
-      $end = _potx_find_end_of_function($ti);
-      $tn = $ti;
-      while ($tn < $end) {
-        // Look through the code until the end of the function.
-        if ($_potx_tokens[$tn][0] == T_CONSTANT_ENCAPSED_STRING && in_array($_potx_tokens[$tn][1], array("'title'", '"title"', "'description'", '"description"')) && $_potx_tokens[$tn+1][0] == T_DOUBLE_ARROW) {
-          if ($_potx_tokens[$tn+2][0] == T_CONSTANT_ENCAPSED_STRING) {
-            // Menu items support no context.
-            $save_callback(
-              _potx_format_quoted_string($_potx_tokens[$tn+2][1]),
-              POTX_CONTEXT_NONE,
-              $file,
-              $_potx_tokens[$tn+2][2]
-            );
-            $tn+=2; // Jump forward by 2.
+  $hooks = array('_menu', '_menu_alter');
+  $keys = array("'title'", '"title"', "'description'", '"description"');
+
+  foreach ($hooks as $hook) {
+    if (isset($_potx_lookup[$filebase . $hook]) && is_array($_potx_lookup[$filebase . $hook])) {
+      // We have this menu hook in this file.
+      foreach ($_potx_lookup[$filebase . $hook] as $ti) {
+        $end = _potx_find_end_of_function($ti);
+        $tn = $ti;
+        while ($tn < $end) {
+
+          // Support for array syntax more commonly used in menu hooks:
+          // $items = array('node/add' => array('title' => 'Add content'));
+          if ($_potx_tokens[$tn][0] == T_CONSTANT_ENCAPSED_STRING && in_array($_potx_tokens[$tn][1], $keys) && $_potx_tokens[$tn+1][0] == T_DOUBLE_ARROW) {
+            if ($_potx_tokens[$tn+2][0] == T_CONSTANT_ENCAPSED_STRING) {
+              // We cannot export menu item context.
+              $save_callback(
+                _potx_format_quoted_string($_potx_tokens[$tn+2][1]),
+                POTX_CONTEXT_NONE,
+                $file,
+                $_potx_tokens[$tn+2][2]
+              );
+              $tn+=2; // Jump forward by 2.
+            }
+            else {
+              potx_status('error', t('Invalid menu %element definition found in %hook. Title and description keys of the menu array should be literal strings.', array('%element' => $_potx_tokens[$tn][1], '%hook' => $filebase . $hook .'()')), $file, $_potx_tokens[$tn][2], NULL, 'http://drupal.org/node/323101');
+            }
           }
-          else {
-            potx_status('error', t('Invalid menu %element definition found in %hook. Title and description keys of the menu array should be literal strings.', array('%element' => $_potx_tokens[$tn][1], '%hook' => $filebase .'_menu()')), $file, $_potx_tokens[$tn][2], NULL, 'http://drupal.org/node/323101');
+
+          // Support for array syntax more commonly used in menu alters:
+          // $items['node/add']['title'] = 'Add content here';
+          if (is_string($_potx_tokens[$tn]) && $_potx_tokens[$tn] == '[' && $_potx_tokens[$tn+1][0] == T_CONSTANT_ENCAPSED_STRING && in_array($_potx_tokens[$tn+1][1], $keys) && is_string($_potx_tokens[$tn+2]) && $_potx_tokens[$tn+2] == ']') {
+            if (is_string($_potx_tokens[$tn+3]) && $_potx_tokens[$tn+3] == '=' && $_potx_tokens[$tn+4][0] == T_CONSTANT_ENCAPSED_STRING) {
+              // We cannot export menu item context.
+              $save_callback(
+                _potx_format_quoted_string($_potx_tokens[$tn+4][1]),
+                POTX_CONTEXT_NONE,
+                $file,
+                $_potx_tokens[$tn+4][2]
+              );
+              $tn+=4; // Jump forward by 4.
+            }
+            else {
+              potx_status('error', t('Invalid menu %element definition found in %hook. Title and description keys of the menu array should be literal strings.', array('%element' => $_potx_tokens[$tn+1][1], '%hook' => $filebase . $hook .'()')), $file, $_potx_tokens[$tn+1][2], NULL, 'http://drupal.org/node/323101');
+            }
           }
+          $tn++;
         }
-        $tn++;
       }
     }
   }
Index: tests/potx.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/potx/tests/Attic/potx.test,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 potx.test
--- tests/potx.test	15 Feb 2010 10:49:24 -0000	1.1.2.3
+++ tests/potx.test	25 Jan 2011 10:01:08 -0000
@@ -7,7 +7,7 @@
  */
 
 class PotxTestCase extends DrupalWebTestCase {
-  
+
   public static function getInfo() {
     return array(
       'name' => t('Translation template extractor'),
@@ -17,8 +17,9 @@ class PotxTestCase extends DrupalWebTest
   }
 
   public function setUp() {
-    // Set up required modules for l10n_community.
+    // Set up required modules for potx.
     parent::setUp('locale', 'potx');
+
     // Add potx.inc which we test for its functionality.
     include_once(drupal_get_path('module', 'potx') .'/potx.inc');
     // Store empty error message for reuse in multiple cases.
@@ -44,11 +45,11 @@ class PotxTestCase extends DrupalWebTest
     $this->assertMsgID('one more test potx permission');
     $this->assertMsgID('1 test string');
     $this->assertPluralID('@count test strings');
-    
+
     // Installer string should not appear in runtime output.
     $this->assertNoMsgID('Installer only test string');
     $this->assertMsgID('Dynamic callback test string');
-    
+
     // No context support yet.
     $this->assertNoMsgIDContext('Test string in context', 'Test context');
     $this->assertMsgID('Test string in context');
@@ -59,7 +60,7 @@ class PotxTestCase extends DrupalWebTest
     $this->assertMsgID('Dynamic callback test string');
     $this->assertNoMsgID('1 test string');
     $this->assertNoMsgID('This is a test string.');
-    
+
     $this->assert(count($this->potx_status) == 3, t('3 error messages found'));
     $this->assert($this->potx_status[0][0] == $this->empty_error, t('First empty error found.'));
     $this->assert($this->potx_status[1][0] == $this->empty_error, t('Second empty error found.'));
@@ -84,11 +85,15 @@ class PotxTestCase extends DrupalWebTest
     $this->assertMsgID('one more test potx permission');
     $this->assertMsgID('1 test string');
     $this->assertPluralID('@count test strings');
-    
+    $this->assertMsgID('Test menu item description');
+    $this->assertMsgID('Test menu item description altered (1)');
+    $this->assertMsgID('Test menu item description altered (2)');
+    $this->assertMsgID('Test menu item title altered');
+
     // Installer string should not appear in runtime output.
     $this->assertNoMsgID('Installer only test string');
     $this->assertMsgID('Dynamic callback test string');
-    
+
     // No context support yet.
     $this->assertNoMsgIDContext('Test string in context', 'Test context');
     $this->assertMsgID('Test string in context');
@@ -105,7 +110,7 @@ class PotxTestCase extends DrupalWebTest
     $this->assert($this->potx_status[1][0] == $this->empty_error, t('Second empty error found.'));
     $this->assert($this->potx_status[2][0] == $this->empty_error, t('Third empty error found.'));
   }
-  
+
   /**
    * Test parsing of Drupal 7 module.
    */
@@ -131,10 +136,15 @@ class PotxTestCase extends DrupalWebTest
 
     $this->assertMsgID('1 test string');
     $this->assertPluralID('@count test strings');
-    
+
+    $this->assertMsgID('Test menu item description');
+    $this->assertMsgID('Test menu item description altered (1)');
+    $this->assertMsgID('Test menu item description altered (2)');
+    $this->assertMsgID('Test menu item title altered');
+
     $this->assertNoMsgID('Installer only test string');
     $this->assertMsgID('Dynamic callback test string');
-    
+
     // Context support added.
     $this->assertMsgIDContext('Test string in context', 'Test context');
 
@@ -157,7 +167,7 @@ class PotxTestCase extends DrupalWebTest
     // Parse and build the Drupal 6 module file.
     $filename = drupal_get_path('module', 'potx') .'/tests/potx_test_6.info';
     $this->parseFile($filename, POTX_API_6);
-    
+
     // Look for name, description and package name extracted.
     $this->assertMsgID('Translation template extractor tester');
     $this->assertMsgID('Test description');
@@ -189,7 +199,7 @@ class PotxTestCase extends DrupalWebTest
   private function parseFile($filename, $api_version, $string_mode = POTX_STRING_RUNTIME) {
     global $_potx_store, $_potx_strings, $_potx_install;
     $_potx_store = $_potx_strings = $_potx_install = array();
-    
+
     potx_status('set', POTX_STATUS_STRUCTURED);
     _potx_process_file($filename, 0, '_potx_save_string', '_potx_save_version', $api_version);
     _potx_build_files($string_mode, POTX_BUILD_SINGLE, 'general', '_potx_save_string', '_potx_save_version', '_potx_get_header', NULL, NULL, $api_version);
@@ -202,7 +212,7 @@ class PotxTestCase extends DrupalWebTest
     $this->potx_status = potx_status('get', TRUE);
     //debug(var_export($this->potx_status, TRUE));
 }
-  
+
   /**
    * Helper function to assert an msgid construct in the .po file.
    */
Index: tests/potx_test_6.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/potx/tests/Attic/potx_test_6.module,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 potx_test_6.module
--- tests/potx_test_6.module	20 Oct 2009 15:49:36 -0000	1.1.2.2
+++ tests/potx_test_6.module	25 Jan 2011 10:01:08 -0000
@@ -19,9 +19,24 @@ function potx_test_6_menu() {
   $items['translate/test-empty'] = array(
     'title' => '',
   );
+  $items['translate/test-empty']['description'] = 'Test menu item description';
   return $items;
 }
 
+/**
+ * Implementation of hook_menu_alter()
+ */
+function potx_test_6_menu_alter(&$items) {
+  $items['translate/test-empty']['description'] = 'Test menu item description altered (1)';
+  $items['translate/test-empty'] = array_merge(
+    $items['translate/test-empty'],
+    array(
+      'title' => 'Test menu item title altered',
+      'description' => 'Test menu item description altered (2)',
+    )
+  );
+}
+
 function potx_test_6_page() {
   t('This is a test string.');
   format_plural($count, '1 test string', '@count test strings');
Index: tests/potx_test_7.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/potx/tests/Attic/potx_test_7.module,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 potx_test_7.module
--- tests/potx_test_7.module	20 Oct 2009 15:49:36 -0000	1.1.2.2
+++ tests/potx_test_7.module	25 Jan 2011 10:01:08 -0000
@@ -19,9 +19,24 @@ function potx_test_7_menu() {
   $items['translate/test-empty'] = array(
     'title' => '',
   );
+  $items['translate/test-empty']['description'] = 'Test menu item description';
   return $items;
 }
 
+/**
+ * Implementation of hook_menu_alter()
+ */
+function potx_test_7_menu_alter(&$items) {
+  $items['translate/test-empty']['description'] = 'Test menu item description altered (1)';
+  $items['translate/test-empty'] = array_merge(
+    $items['translate/test-empty'],
+    array(
+      'title' => 'Test menu item title altered',
+      'description' => 'Test menu item description altered (2)',
+    )
+  );
+}
+
 function potx_test_7_page() {
   t('This is a test string.');
   format_plural($count, '1 test string', '@count test strings');
