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.
On our sites, already existing translations disappear and the menu links are shown in English.
I debugged the code and found that the entries for the textgroup menu in the tables i18n_string and locales_source are gone.
In addition the existing translations seem to be "moved" to the default textgroup.
So far I have no idea what causes this trouble. But as a workaround I run these queries to bring back the database entries when a translation disappears:
INSERT INTO locales_source (location, textgroup, source, context, version) SELECT CONCAT('menu:item:', mlid, ':title'), 'menu', lsa.source, CONCAT('item:', mlid, ':title'), 1 FROM locales_source AS lsa JOIN menu_links ON (lsa.source = link_title) JOIN menu_custom USING (menu_name) LEFT JOIN locales_source AS lsb ON (lsa.source = lsb.source AND lsb.textgroup = 'menu') WHERE i18n_mode = 5 AND lsa.textgroup = 'default' AND lsb.textgroup IS NULL;
REPLACE INTO i18n_string SELECT DISTINCT lid, textgroup, context, mlid, 'item', 'title', mlid, '' FROM locales_source JOIN menu_links ON (source = link_title) WHERE textgroup = 'menu' AND context = CONCAT('item:', mlid, ':title');
Afterwards the menu link could be translated again.
Comments
Comment #1
Jose Reyero CreditAttribution: Jose Reyero commentedNeed steps on how to reproduce this.
Comment #2
mkalkbrennerThat's the problem. I don't know how this happens. The only thing I can say is, that the sites are "stable", what means that there's no configuration going on. But the translations randomly disappear every two or three days. And it only effects two or three entries when it happens. But every time it effects different entries.
Very strange ...
Comment #2.0
mkalkbrennerUpdated issue summary.
Comment #2.1
mkalkbrennerUpdated issue summary.
Comment #3
mkalkbrennerIt happened again.
We moved a menu entry from the second level to the first level and than again back to the second level.
The entry of that menu entry disappeared from the menu textgroup!
Comment #4
mstiem CreditAttribution: mstiem commentedHey guys,
I have the same issue in my project. When I shuffle my menu entries around several translations are gone. Can't find any fix for that.
Comment #5
cspitzlayOne additional detail:
The last time it happened to us the user was logged in on the German version of the site.
The deleted translations were all German, while the Dutch ones remained intact.
Comment #6
Jose Reyero CreditAttribution: Jose Reyero commentedYes, this is useful information, but still, we don't have a step by step to reproduce the bug, which makes it kind of random, you cannot tell when it happens, thus you cannot tell how/when it is fixed.
Comment #7
mattew CreditAttribution: mattew commentedI encountered the same issue and there is a simple step by step to reproduce :
We have a website using at least two languages : english and french. And the content type allow to create a menu item from the node form.
You will be redirected to french version of the node, and the menu item is in English. The translation seems to be lost...
When viewing the menu item translation table, we can see that the menu is marked as translated, but the text is in english.
I think this issue is critical because data is lost at each page saving.
N.B. : We are using Entity translation.
Comment #8
SqyD CreditAttribution: SqyD commentedThis sounds very similar to this issue that was found and fixed in the Expire module #1451336: Reverting a node revision deletes menu item and this issue in Token #1317926: menu_tokens function should not change the node object. The fix involved avoiding doing operations on the the menu item directly but on a clone of the object. It wouldn't surprise me if this could be a fix for this issue as well.
Comment #9
mkalkbrenner@SpyD: Thanks for that information. I hope to find some time to debug this soon.
Comment #9.0
mkalkbrennerUpdated issue summary.
Comment #10
Marty2081 CreditAttribution: Marty2081 commentedI have the same issue in a project of ours. We have a custom module that defines a MENU_NORMAL_ITEM with an English title. The title is translated through the translation interface and shows up fine until we change the weight of the menu-item. Then, the English title is shown where we saw the translation before. When we "reset" the menu item, the translation works again. Our workaround is to move the other menu items around and not touch the menu item from the module, but that won't do in the long run.
Comment #11
GuillaumeDuveauI can't reproduce #10, Marty2081 could you reproduce it with an existing contributed module and detail all the steps ?
For example, are you translating the menu item of a menu set to "localize and translate" with i18menu interface ?
Or translating with admin/config/regional/translate ?
I believe that admin/config/regional/translate should be used to deal with menu items provided by contributed modules.
Some should have a look at that issue, too : #1693074: Change menu translation approach (i18n_menu_translated_menu_link_alter() skips item subtree processing) : menu links become disabled upon saving a node which is in a different language than the interface
Comment #12
Marty2081 CreditAttribution: Marty2081 commentedYes, the menu (Main menu) is set to "translate and localize". The menu item is translated using admin/config/regional/translate.
When the menu-item is reset (and the translation works), there is also a translate link in the menu edit screen leading to admin/structure/menu/item/2756/translate. However that link results in a 'access denied' message.
Once the menu-item is saved in another position, the link results in a: 'This object has no strings available for translation.'
Comment #13
GuillaumeDuveau@Marty, try this :
- reset the menu item, the "reset" option must then disappear, and the menu item language must be set to "no language"
- check that the translation works, even if the position of your item is not good of course because of the reset
- go to LANGUAGE/admin/structure/menu/manage/MENU and re-order the item. If you just go to /admin/structure/menu/manage/MENU without the LANGUAGE prefix (for the other language than english which is the default one in my setup), then you will re-order the item, but you will loose the translation.
Thing is, we have 2 different problems in that issue, it should maybe be split in 2 issues :
- i18n_menu should deal properly with menu items provided by modules (here ?)
- menu links become disabled upon saving a node which is in a different language than the interface, see patch in #1693074: Change menu translation approach (i18n_menu_translated_menu_link_alter() skips item subtree processing)
Comment #14
Marty2081 CreditAttribution: Marty2081 commented@guix, first of all: thanks for you time and trying to help me. I appreciate it.
Unfortunately, if I do as you suggest the translation keeps breaking. I have Dutch as the default language with no path prefix and English as the second language with 'en' as the path prefix. When I reset the menu-item, the language is set to "no language". When I re-order the menu-item, the language stays "no language". I've tried re-ordering at en/admin/structure/menu/manage/MENU, but the translation still breaks. If I reset the item the translation works again.
I don't know if #1693074: Change menu translation approach (i18n_menu_translated_menu_link_alter() skips item subtree processing) is related to this issue.
Comment #15
GuillaumeDuveau@Marty2081: You are welcome, well I'm trying like you said :) Well, last idea I have is to try to reset, then re-order from admin/structure/menu/manage/MENU (that is, with the Dutch interface). But you probably already tried it.
Comment #16
Jose Reyero CreditAttribution: Jose Reyero commentedJust raising the priority of the issue won't help fixing it faster.
Comment #17
ChrisValentine CreditAttribution: ChrisValentine commentedI'm getting this too. Not entirely sure what triggers it but its not necessarily related to the page I'm working on. I add some links, translate some pages, go back to the menu management and some apparently random links have become disabled.
Versions:
Core - 7.26
Internationalization - 7.x-1.10
Content translation - 7.26
Entity Translation - 7.x-1.0-beta3
Field translation - 7.x-1.10
String translation - 7.x-1.10
Block languages - 7.x-1.10
Language Cookie - 7.x-1.8
Comment #18
ChrisValentine CreditAttribution: ChrisValentine commentedHave just found some consistency. If you have a Page that has a menu entry and you translate it and put it into the menu under its new language - if you ever edit the page again, its menu entry will be disabled.
Comment #19
cspitzlay@ChrisValentine: Are your menu entries just disabled, or are the translations removed from the database? For us it is the latter.
Comment #20
ChrisValentine CreditAttribution: ChrisValentine commentedNo, they're just disabled - toggle the checkbox and they re-appear.
Comment #21
ChrisValentine CreditAttribution: ChrisValentine commentedI've also just noticed that the "Parent item" selector in the menu section of the page edit form also incorrectly shows the status of links already in the menu as disabled.
Comment #22
Owen Barton CreditAttribution: Owen Barton commentedFor folks ending up on here using Features, you should check #1632378: Why do menu items need to be marked as customized ? - this appears as disappearing translations when you revert features.
Comment #23
ckngNot sure if it is similar issue, for me the menu links is intact, but the language column is reset to und. What triggered the reset seems to be features export (NOT revert), but per #22, the 'customized' is 1.