Hi,
in i18nmenu.module there is a little typo that prevents the menu strings from being refreshed on the "Translate interface" page. The following patch replaces "profile" by "menu" in hook_locale.

CommentFileSizeAuthor
i18nmenu.locale_refresh.patch374 bytesFrank Steiner
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Frank Steiner’s picture

Ok, I see that this is actually not enough because even if the locale hook is now running, it fails to find menu strings that were created when creating a new page. If you select a menu title for the page, it will be stored with the customized=false so the check if ($link['customized']) in i18nmenu_localize_tree will fail. Therefore such menu strings won't be found when refreshing the strings.

customized is only set to true if a menu entry is somehow edited on the Site Building>>Menus pages, but of course this is not nice. A user usually creates a page with a menu entry and a language, then goes to "Translate interface" and expects to find the menu title there, so that it can be localized before translating the page.

So we have two options: Remove the if ($link['customized']) from i18nmenu_localize_tree or define $item['customized']=1; in the function 18nmenu_menu_link_alter. Maybe that's what you plan todo with // @ TO DO: Refresh texts that's noted in this function.

I'm not sure what's the right solution, so I don't offer a patch here. For my purposes I've removed the check in i18nmenu_localize_tree which seems to work fine. Now I can immediately find and translate every new menu that I've created when creating a new page.

AaronCollier’s picture

Status: Active » Needs work

Either of those solutions sounds complicated (I mean maybe effecting other things as well). Not sure which way I'd vote. Could you do a patch for both and we could try testing both?

Frank Steiner’s picture

Hmm, I don't now what's wrong at the moment, but I cannot attach the patches. They just don't show up after atacching and posting the comment. I will try again later :-)

Frank Steiner’s picture

Ok, I don't know what's wrong with those files :-( I can attach other patches in other posts, but not the i18n patches here, so I post them.

Patch 1:

--- i18nmenu.module     2008-06-06 10:16:03.000000000 +0200
+++ i18nmenu.module.orig        2008-06-06 10:15:58.000000000 +0200
@@ -129,7 +129,8 @@
   global $language;
   foreach($tree as $index => $item) {
     $link = $item['link'];
-    if ($link['customized']) {
+    // disable check for customized to find menus that were created when creating a new page
+    // if ($link['customized']) {
       // Remove links for other languages than current
       // Links with language wont be localized
       if (!empty($link['options']['langcode'])) {
@@ -145,7 +146,7 @@
           $tree[$index]['link']['title'] = tt('menu:item:'.$link['mlid'].':title', $link['link_title'], NULL, TRUE);
         }
       }
-    }
+    // }
   }
 }

Patch 2:

--- i18nmenu.module.orig        2008-06-06 10:14:17.000000000 +0200
+++ i18nmenu.module     2008-06-06 10:14:26.000000000 +0200
@@ -59,6 +59,9 @@
   //$original = $item['original_item'];
   //$item['router_path'] = _menu_find_router_path($menu, $item['link_path']);
   //i18nmenu_make_translatable($item);
+
+  // defined menu item 'customized' so that i18nmenu_localize_tree localizes it
+  $item['customized'] = 1;
 }
 
 function i18nmenu_help($section, $arg) {
AaronCollier’s picture

Status: Needs work » Needs review

Generally, when providing patches, you can assign issues to yourself.

Frank Steiner’s picture

Assigned: Unassigned » Frank Steiner

Ah, I didn't know that!

Jose Reyero’s picture

Status: Needs review » Fixed

Applied the first patch, about the typo in locale hook.

About the second part, menu items for nodes (is it what we are talking about?) don't need to go through menu translation as the menu system will just show the menu items for the nodes in the current language.

So I mark this one as fixed, please reopen if you want to follow up with the second part.

(Frank, you can assign issues to yourself any time you are willing to work and follow up on them, just to let us know someone's taking care of the issue....)

Thanks

Frank Steiner’s picture

Hi Jose,

> menu items for nodes (is it what we are talking about?) don't need to go through
> menu translation as the menu system will just show the menu items for the nodes in the current language.

yes, we are talking about menu items for nodes. And with what you just stated, I'm even more confused what exactly "Localized menus" should be :-) Maybe you can say sth. about it in this thread: http://drupal.org/node/230868

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.