Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
translated menu items displayed in the default language.
Comment | File | Size | Author |
---|---|---|---|
#17 | translate-menu-item-1050352-17.patch | 1.02 KB | Wuk |
#17 | translate-menu-item-1050352-17-v2.1.patch | 871 bytes | Wuk |
#15 | translate-menu-item-1050352-15.patch | 646 bytes | justafish |
#8 | menu_items_not_translated-1050352-8.patch | 1.71 KB | nikosnikos |
#2 | missing-t-1050352.patch | 613 bytes | vordude |
Comments
Comment #1
drasgardian CreditAttribution: drasgardian commentedI found a way to get these to translate. Unfortunately I haven't quite figured out how to create patches since things moved over to git.
All I did was add the t() function around $variables['element']['#title'] at the bottom of nice_menus.module
i.e.
Comment #2
vordude CreditAttribution: vordude commentedIt looks like that's probably a good fix. I'd like another set of eyes with some translation knowledge to take a look at this, please, If there are other issues on this front, let's get them squared away.
Thanks.
Comment #3
vordude CreditAttribution: vordude commentedComment #4
FatherShawnThrowing a t() function at this did not work on my multi-lingual site. We need to use the i18n api. See #1236450: Translated menu items show in all languages [Nice Menus] .
I'm willing to help get this working...
Comment #5
FatherShawnLooking at the code, I see that the i18n api is called but doesn't work for me. I'm under time pressure for a project, so I've switched this one to the superfish module which is translating properly in my project. I like nice_menu so I'm still willing to help down the road as time permits...
Comment #6
guldi CreditAttribution: guldi commentedOk, I found the bug. (7.x-2.0)
File: nice_menus.module
Lines: 450, 473
Change this:
'#title' => $menu_item['link']['link_title'],
to this:
'#title' => $menu_item['link']['title'],
If someone could please review this and create a patch?
Thanks!
Comment #7
mesr01 CreditAttribution: mesr01 commentedWas having the same issue here. #6 solved it.
Now version 7.x-2.1. This fix should probably be commited to dev.
Comment #8
nikosnikos CreditAttribution: nikosnikos commented#6 solved the bug for me too.
Here's the patch
I couldn't make a patch on dev version because there's no file in it yet.
Comment #9
aschiwi CreditAttribution: aschiwi commentedHonestly cannot reproduce this issue with a clean install of Drupal. The menu items translate nicely without the patch. Are there any steps to reproduce this behavior?
Either way, patch in #8 applies cleanly and menu item translation still works after applying.
Comment #10
guldi CreditAttribution: guldi commentedIt's correct buddy. Trust me.
$menu_item['link']['link_title'] is not translated, but $menu_item['link']['title'] is.
Don't know your setup. But the project I needed this is over since february. I don't remember what exactly the setup was and I also don't have time to reconstruct it.
Also when you review the whole context of the code you will conclude ['title'] as correct.
Comment #11
aschiwi CreditAttribution: aschiwi commented@guldi: I was just trying to help the issue queue by reviewing the patch and all I'm saying is I cannot reproduce the problem in a brand new Drupal install with just i18n, nice_menus installed and testing with two languages. vordude gave me this issue to check and I'm no coder, but I still wanted to leave my result after spending almost 2 hours on creating a setup to review this. I think this patch is small enough to be rtbc'ed but I cannot judge the code and don't see the problem with current installs of i18n and nice_menus, so just reported my result :)
So either a coder says it's okay to make the change even if it doesn't solve a problem or someone else can reproduce the problem and see if this fixes it.
Comment #12
guldi CreditAttribution: guldi commentedallright. :)
Comment #13
nikosnikos CreditAttribution: nikosnikos commentedThe translation problem appears when the i18n menu configuration is "Translate and Localize. Menu items with language will allow translations. Menu items without language will be localized." and a menu item is "language neutral" (so it's a "Menu items without language").
My default site language is english. If I translate this item in french I always see it in english even if I'm on the french version of my site.
Patch #8 fix this kind of translation.
Comment #14
yareckon CreditAttribution: yareckon commentedThis is definitely a problem we ran into today that resulted in us having to hunt around and finally disable nice menus. nikosnikos describes the correct context to reproduce this -- set a menu to be translatable with a fallback to localization via string translation. What happens is that with nicemenus the fallback to string localization does not work. I can't say if the patch has the right strategy to fix this, but the problem is real.
Comment #15
justafishI've tested this and can reproduce the issue. Changing to $menu_item['link']['title'] fixes the issue. See the equivalent (kind of) at http://api.drupal.org/api/drupal/includes%21menu.inc/function/theme_menu...
One liner patch attached.
Comment #16
justafishComment #17
Wuk CreditAttribution: Wuk commentedThere are two places to change 'link_title' to 'title'.
Created patch against dev.
Tested with i18n menu with localized and translated items.
For 2.1 patch is in translate-menu-item-1050352-17-v2.1.patch file.
Comment #18
rhayun CreditAttribution: rhayun commented#17 solved the bug for me!!! thanks
Comment #19
yugi CreditAttribution: yugi commentedPatches in #17 solved the issue with me as well. Thanks!
Comment #20
bessone CreditAttribution: bessone commented#17 worked for me on 7.x-2.1, thanks!
Comment #21
revnoah CreditAttribution: revnoah commentedI'm glad I found this post. I nearly threw out the module due to this unexpected problem.
Comment #22
JordanMagnuson CreditAttribution: JordanMagnuson commentedGreat patch! Any chance of getting it committed?
Comment #23
kreatIL CreditAttribution: kreatIL commented#17 worked for me, too. It would be great to have this patch commited
Comment #24
DevElCuy CreditAttribution: DevElCuy commentedI'm maintainer of module Menu token. I confirm that patches at #17 fix the issue here and also make Nice menus compatible with Menu token, which makes both modules even more powerful.
Comment #25
fraweg CreditAttribution: fraweg commentedHello develCuy,
for me the translations with menu token works not completly. The menu is translatetd but the sitename without token is changed but with menu token the sitename is not translated.
Best regards
Frank
Comment #26
mohs3n71 CreditAttribution: mohs3n71 commentedthis patch doesn't fixed my problem ...
Comment #27
Wuk CreditAttribution: Wuk commentedWhat patch did you use and what version of nice menus?
Comment #28
xiukun.zhou CreditAttribution: xiukun.zhou commented#25, I think this is menu_token problem
#1590424: Token in menu item title not replaced if i18n menu translation is active
Comment #29
xiukun.zhou CreditAttribution: xiukun.zhou commentedComment #30
DYdave CreditAttribution: DYdave commented@fraweg, @mohs3n71, thanks very much for your comments and reporting.
We would greatly appreciate your feedback on the patch submitted by xiukun.zhou at #1590424-9: Token in menu item title not replaced if i18n menu translation is active.
Additionally, if it doesn't work or you encounter other issues, could you please provide more information (that could include screenshots, ideally) on the problems encountered? That would greatly help us trying to reproduce the issues and come up with a fix or appropriate solution.
I've tested the patch from #17, along with #1590424-9: Token in menu item title not replaced if i18n menu translation is active, applied against, respectively, nice_menus-7.x-2.1+3-dev (2012-06-13, at 94f4988) and menu_token-7.x-1.0-beta3+1-dev (2012-12-22, at 1e251fd) and everything seems to work fine/as expected with with i18n menu with localized and translated items.
This ticket has now been opened for almost a year already and I guess we would all greatly appreciate if this patch could potentially be rolled in/committed, after marking RTBC.
Note: After investigation, it seems the issues that you reported at #25 and #26 are not directly related with the issue discussed in this ticket and seem to relate with rather a different issue: #1590424: Token in menu item title not replaced if i18n menu translation is active from Menu token, in which develCuy is a maintainer.
So we would highly appreciate develCuy's feedback as well, which would also help confirming further if this attempt to fix these issues is successful or needs more work.
Feel free to let us know if you would have any other questions, concerns or issues on any of these patches, we would surely be glad to provide more information.
Any feedback, testing, reporting, questions, comments or issues would be highly appreciated.
Thanks again very much to all in advance.
Comment #31
malberts CreditAttribution: malberts commentedAny updates?
Patch in #17 works for me (nice_menus-7.x-2.1+3-dev) in the scenario described in #13 (menu set to "Translate and localize" and menu item set to "Language neutral".
Comment #32
xiukun.zhou CreditAttribution: xiukun.zhou commentedThanks a lot to nikosnikos, DYdave, develCuy, Wuk, justafish, svovik1 and everyone else for the great work on the patches, testing, reviews and reporting.
It's more time this got committed and I went ahead and had this rolled at: 7.x-2.x: c031a01.
Marking this as fixed.
Please let me know if you would have any other questions, comments, issues or concerns on any of these changes, I would be glad to provide more information.
Thanks again to everyne for the help and great work on this issue.
Cheers!