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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Switching languages with langswitcher

Solved by Klaas View solution

Started by Klaas 3 years ago · 5 replies · 622 views
3 years ago

Hello,

Grav: 1.7.41.1
Plugin: langswitcher version 3.1.1 (so the 2015 forum post no longer seems relevant)
Theme: Quark derived (deleting the footer and the GRAV logo)
Modular page

I'm building a multiple language site using langswitcher, languages are en and nl (short names).
Pages are generated correctly, URL has /en and /nl showing the correct content.

What I can't figure out is how to get a menu on screen (maybe in the menu bar on top) where the user can switch the language.

many thanks for your assistance!

Klaas

3 years ago

@KlaasHDec,

What I can’t figure out is how to get a menu on screen (maybe in the menu bar on top) where the user can switch the language

Didn't the README of the langswitcher plugin answer this question in the Usage section?

3 years ago

Not in a way I understand...

It is the somewhere in "into your own theme somewhere" that confuses me.

Ha.
So maybe add

TWIG
{% include 'partials/langswitcher.html.twig' %}
{% include 'partials/langswitcher.hreflang.html.twig' %}

somewhere else perhaps.

Let's try partials/base.html.twig ...

That does give me a switch.

Now to get it in the menu and get to it work...

Thanks for the nudge.
Not yet completely solved but getting there.

Klaas

3 years ago

Almost. Putting the % includes in the navbar section of partials/base.html.twig

I have the option to switch from /nl to /en, but the /en page does not have the menu to switch back to nl

3 years ago Solution

I have to get rid of the
{% include 'partials/langswitcher.hreflang.html.twig' %}

Not sure yet I know why.
Maybe counts as solved anyway.

3 years ago

.... almost

I have modified the partials/base.html navbar sectionto show the language selector and deleted the bit with the Grav logo.

So in English, I get the language selection menu without the Grav logo.
In nl, I get the language section menu with the Grav logo.

Any nudging is still most welcom.

Klaas

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 75 1 week ago
Plugins · by Xavier, 4 weeks ago
2 81 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1208 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 74 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 99 2 months ago