Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

A select language menu listing only available page's languages?

Started by Muut Archive 10 years ago · 3 replies · 525 views
10 years ago

I'm developing a site for 3 languages. Some of the pages are only available in 1 language, some are translated for more (e.g. 2 or all 3 languages).

I can generate a sub-menu that hard-codes 3 menu items for the foreseen languages. But it feels not user friendly if such switch-language-menu presents all 3 language menu items while the page exists only in 1 or 2 languages.

How to generate the switch language menu that only presents the languages choices that have a corresponding translation for the current page?

So if the current page exists as default.en.md and default.fr.md, how to build a sub menu that contains links to switch to language en or fr.

Thanks

10 years ago

I have been searching for this for a long time!!! @franchan !
Thank you very much for sharing it publically.
I don't forget also that the other day, you gave me an important infortant information with {{ class }} in the base.html.twig of antimatter theme...
It seems that you're french like me: are you parisian too? What project are you working on?
(Like to know a little more, sorry...)

10 years ago

Would be cool if you submit a PR to the official langswitcher plugin. It would need to be 'backwards' compatible in output at least, so would require a few options in the plugin config.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1366 9 years ago
Archive · by Muut Archive, 9 years ago
2 940 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2960 9 years ago
Archive · by Muut Archive, 9 years ago
3 1124 9 years ago