1

The site in question is running Drupal 7 and has a sub-folder structure for the languages. E.g. http://site.tld/ for default language and http://site.tld/en/ for english.

The editors can choose if they want their admin interface in either language by logging in on the user page for any available language.

My problem now is that on the node create/update page, Drupal seems to use the global $language to determine what options to retrieve for the Parent item under Menu settings, rather then using the current node's language.

So if an editor is editing a node in the default language but on the english interface, only english menu items will be in the select list mentioned above. When saving the node, the Parent item will be reset to the base of the menu and the previous menu structure will be lost.

What I want is a way of altering the chosen language for when that option list is being built. I suppose one way would be to use hook_form_alter and rebuild the options for that field, but that doesn't feel like the right way of doing it.

Is there another way of solving this issue?

UPDATED

It doesn't necessarily need to work perfectly. I guess one way would be to have one language neutral menu and then localize the menu items instead. That would bloat the main menu though, especially when there are multiple languages.

Yet another hack would be to do as @reptilex suggested in his answer and then overwrite the admin translations with one language. I'd prefer not to though.

0

I have a similar problem, I have decided that I don't want to ajax reload the form when the language is changed because things like entity relationships (which is my current problem) don't work even then.

My advice is to force the language of the editing / adding node to be the same as the interface. For creating/ adding this is easy you set it for the content type when you edit the multilingual settings. The translation interface redirects correclty and the content creation too (it expects you to be in the language you want to create).

So with that option you would be on the safe side, EXCEPT when you are in pages like "find content" and use the edit link or write the url by hand. What I am trying to do now is to force a redirect when you try to edit the link by a url like /node/223/edit. This is something that should be possible with hook_menu_alter.I would force a redirect to [language of the content]/node/223/edit.

I would have thought that there was a better possibility but I have found none. I will be monitoring this question to see if someone has a better idea or there is a much better solution out there.

| improve this answer | |
  • Regrettably, that is not really an option for me. The company does only want the interface in one language (their native language), and switching between languages all the time feels kind of from an usability perspective. Thanks for your input though! – hampusn Oct 15 '12 at 15:17
  • Then happy rebuilding of the forms and happy ajaxing for every time the language is changed in the forms. – reptilex Oct 16 '12 at 16:01
  • Well, hopefully there's another way. After all, it was the reason I came here. :) – hampusn Oct 17 '12 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.