Hi all,
my setup:
- no other menu modules installed
- Language negotiation: Domain name only.
( /admin/settings/language/configure )
- A new [i18n] block menu "about" created, multilingual settings for this block is setted up to "language: All languages".
( /admin/build/block/configure/i18nmenu_node/menu--menu-about )
Step to create the issue:
- I create a node in default language (en), and create its menu item directly inside the "add node" creation page
- I DO NOT translate this node in other languages
Result:
The menu item is always shown between languages, pointing to default original creation node.
Instead I think the menu item should not be shown in languages where its node is not translated.
I'm missing something?
Thank you very much
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | hide-untranslated-1231196-9.patch | 4.13 KB | gaëlg |
Comments
Comment #1
plachJust uncheck the "Enable node translations" checkbox on the node form menu item widget, save, and you should be done.
Comment #2
mxtThank you very much for your answer platch, but I can't apply your suggestion: I have MANY languages available in my site, and menu item translation have to be available only for SOME languages.
E.g:
node/2 must have a translation in Italian and German, but NOT in Spanish for example.
So, its menu item translation must be available for Italian and German.
How we can resolve?
Thank you very much!
Comment #3
mxtComment #4
plachAs I told you this cannot be covered by MTN: if you disable node translation for a menu item not having a translation for each language and then resave all the translations, for each one you should get a menu item with the corresponding language assigned. This will make it appear only when viewing that language and no menu item will appear when there is no translation for the current language.
Comment #6
kork commentedYou can just hide the menu item if no translation exits:
Comment #7
mxtThank you very much kork!
Comment #8
plachThis looks like an useful optional behavior: we could have a checkbox in the menu settings. Patches welcome :)
Comment #9
gaëlgWhat about this?
Comment #10
plach@GaelG:
Thanks for working on this!
I tried hard not to introduce additional queries in this phase. You should check
$item['options']['translations']instead: if thetranslationkey is defined but there is no entry for the current language then the optional hidden behavior should kick in. See also #6.As per the comment above I don't think this is actually needed.
I like this function, but I'd prefer to have shorter name. E.g.
i18nmenu_node_hide_untranslated. Also, to preserve backward compatibility we should introduce an update function setting the variable value to false for existing sites.Comment #11
gaëlgActually we need this function because if the content only exists for one language (the source node),
$item['options']['translations']is empty.Comment #12
plachThen we should try and see if populating the translations array with only the source value does not break everything, because introducing a query for each rendered menu item is a no go.
Comment #13
gaëlgIndeed. But as I don't know well how this module is designed, maybe you could have a look at this by yourself? For sure it's the best way to handle this, but I don't want to introduce new bugs.