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.
I use Views to create page with default menu tab and menu tab structure. I found that the normal menu link built from "default menu tab" cannot be translated.
It shows the following error:
Fatal error: Call to a member function get_string() on a non-object in /home/mallbar/www/demo13/sites/all/modules/i18n/i18n_string/i18n_string.pages.inc on line 63
Comments
Comment #1
pedrop CreditAttribution: pedrop commentedsame happened to me
Drupal 7.19 7.19 Up to date
Internationalization (i18n) 7.x-1.8 7.x-1.8 Up to date
Views translation (i18nviews) 7.x-3.x-dev 7.x-3.x-dev Up to date
Localization client (l10n_client) 7.x-1.1 7.x-1.1 Up to date
Localization update (l10n_update) 7.x-1.0-beta3 7.x-1.0-beta3 Up to date
Comment #2
pedrop CreditAttribution: pedrop commentedSolution / workaround:
after disabling the menu entry in views the menu item remained active and I was able to translate it.
Comment #3
Jose Reyero CreditAttribution: Jose Reyero commentedThis module only translates Drupal core custom menus, doesn't even try with menus generated by other modules. Maybe try i18nviews module.
Comment #4
adamtong CreditAttribution: adamtong commentedI have installed i18nviews module, but still not working actually.
Comment #5
rpsuI deleted (removed in db) menu items created by views and re-created them manually by adding items with path into menu. This way menu items can be translated with no problems, but I am thinking maybe we should have warning for these non-system-menu items?
Getting unexpected Fatal error thrown is perhaps not the way to have this?
(I re-opened issue for this discussion)
Comment #6
jordan8037310 CreditAttribution: jordan8037310 commentedRan into this same issue, I am in favor of #5's solution of warning user's that they can't translate views generated Menu Links.
Comment #7
hedel CreditAttribution: hedel commentedI ran into the same issue and I solve it
In my case, I wanted translate a element built by views in a menu set to 'Translate and Localize' but the element was set to 'Language neutral'. I just set a language in the element and after was possible translate it without problem.
#3 Jose Reyero: if is right, maybe can be a condition for force the user to set the language in the menu item before translate it (only one idea).
greetings!
Comment #8
jmuzz CreditAttribution: jmuzz commentedMy issue was similar but the item I wanted to translate was not the one generated by the view, however it was a menu item with the same title as the one the view generated. The view generated item was in a different (non-translatable) menu, and when it was there the item I wanted to translate would not get added to the menu group of strings. Changing the setting on the view to remove the menu item solved the problem for me.
Comment #9
skyredwangMenus created by contributed modules can be translated. The menu item created by contributed modules is language netural, you need to set it to a specific langauge, then you can translate it.
However, if the original menu langauge is unset, the error message should be more useful than
This object has no strings available for translation.
Comment #10
jmuzz CreditAttribution: jmuzz commentedTrue, they can be translated this way. I think there is some confusion around the terminology being used here. My understanding of the problem is that they can not be localized. When they have no set language they should appear in the Menu group of the Translate Strings page after a string update has been done, and instead of the error message it should allow you to localize it through the translate tab like when you create your own language neutral menu item.
Comment #11
Taran2LSorry, posted to a wrong issue. See #1897696: Inconsistent check for translatable title in _i18n_menu_link_localizable_properties() and _i18n_menu_link_localize()
Comment #12
kenorb CreditAttribution: kenorb commentedThe same problem here, I'm trying to translate Forums (/forum) menu item and when going to Translate tab, I've the message: This object has no strings available for translation.
Comment #13
kamida CreditAttribution: kamida commentedHad a problem similar to the one described in #8, except removing the view's menu item didn't cut it.
For whatever reason, the solution described in #7 did it for me (set a language, saved configuration, then went back and put it back to 'Language neutral' and it was finally translatable).
Thanks!
Comment #14
adityadubay CreditAttribution: adityadubay commented"Add content" of navigation menu not found in Translate interface. How to translate that????
Thats a part of core menu :(
Comment #15
Leksat CreditAttribution: Leksat at Amazee Labs commentedI ran into that fatal error on some links. Debug shows that
i18n_menu_link::get_strings()
returns nothing because_i18n_menu_link_localizable_properties()
also returns nothing.I wonder if this really happens? I know that the core does translate the router item, but I think it does not handle the menu links...
I removed that "core translation" checks, changed the function to this
and now it works good for me.
Can someone tell if this is a correct approach?