It is possible that the Mixed menu II cookbook is malfunctioning with languages, I have been trying it for several days and with one language working, however the version for the second language does not update.
Here the site.yml
columns:
- width: 1/1
sections:
fields:
type: fields
headline: Custom menu
fields:
nestedMenu:
type: structure
label: Nested menu
fields:
menufields: fields/menufields
hasSubmenu:
type: toggle
text: Add a submenu?
submenu:
type: structure
label: Second Level Items
when:
hasSubmenu: true
fields:
menufields: fields/menufields
What does that mean exactly? Nothing is stored in the content files? Or the output on the frontend is not correct?
The menu works in the panel but when I change the language, the first level of pages are created well but the submenu pages are not translated, in fact the language change is not saved in these submenus, it does not update it on site.eu.txt
I’m not sure if I fully understand. Do you expect the menus to automatically save in the non-default language? If a translated site.languagecode.txt file already exists, changes to your menu will not auto-reflect in the translations.
And if a non default site content file does not exist yet, you will have to make some changes somewhere to be able to store the translation.
Changes you make to any default-language content for which a translation file already exist always have to be added manually to the translations.
An alternative would be to set the complete field to translate: false
in which the field is not translatable at all and the frontend will always fall back to the default language (won’t work with this menu builder if you want custom link titles in different languages.
The language file site.languagecode.txt exists for each language, and I translate the content for each language in the panel, what happens is:
- The main language (1) dominates when organizing the menu, if I change the order of the items in language (2), this is not updated in language (2).
- When I write the translation in its corresponding language, and save the changes, it says ok, but if I refresh the page the changes have not been saved in the second language.
I have just tested this and cannot reproduce it. Have you made sure to actually always hit the OK button for each level and then to finally save the site when the orange bar at the bottom pops up?
This will be clearer than my words
Could you post your blueprint and your language definition? The I can test again tomorrow.
Are you using the latest Kirby version?
For spanish
'code' => 'es',
'default' => true,
'direction' => 'ltr',
'locale' => 'es_ES',
'name' => 'Español',
'slug' => [
'ñ' => 'n',
'á' => 'a',
'é' => 'e',
'í' => 'i',
'ó' => 'o',
'ú' => 'u'
],
'locale' => [
LC_COLLATE => 'es_ES.utf-8',
LC_MONETARY => 'es_ES.utf-8',
LC_NUMERIC => 'es_ES.utf-8',
LC_TIME => 'es_ES.utf-8',
LC_MESSAGES => 'es_ES.utf-8',
LC_CTYPE => 'es_ES.utf-8'
],
'translations' => […
],
'url' => '/'
];
For local language
return [
'code' => 'eu',
'default' => false,
'direction' => 'ltr',
'locale' => 'eu_EU',
'name' => 'Euskara',
'locale' => [
LC_COLLATE => 'eu_EU.utf-8',
LC_MONETARY => 'eu_EU.utf-8',
LC_NUMERIC => 'eu_EU.utf-8',
LC_TIME => 'eu_EU.utf-8',
LC_MESSAGES => 'eu_EU.utf-8',
LC_CTYPE => 'eu_EU.utf-8'
],
'translations' => […
],
'url' => NULL
];
site.yml
title: Site
columns:
- width: 1/1
sections:
fields:
type: fields
headline: Custom menu
fields:
nestedMenu:
type: structure
label: Nested menu
fields:
menufields: fields/menufields
hasSubmenu:
type: toggle
text: Add a submenu?
submenu:
type: structure
label: Second Level Items
when:
hasSubmenu: true
fields:
menufields: fields/menufields
- width: 1/2
sections:
paginas:
type: pages
template:
- contacto
- apartados
- proyectos
- notes
- home
- default
- legal
- cosas
- width: 1/2
sections:
notes: sections/notes
menufields.yml
type: group
fields:
isExternal:
type: toggle
label: External link?
linkTitle:
type: text
label: Link title
pageLink:
label: Page link
type: pages
max: 1
when:
isExternal: true
externalLink:
type: text
label: External link
when:
isExternal: true