Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Language switcher with short language notation

Solved by pamtbaau View solution

Started by Ton Haarmans 6 years ago · 2 replies · 1133 views
6 years ago

Does anybody know how the language switcher plugin sets the language links in a short notation? For instance, instead of 'English' I would like to show 'EN'

6 years ago Solution

@TonHaarmans, Try the following steps:

  • Copy file /user/plugins/langswitcher/templates/partials/langswitcher.html.twig from the Langswitcher plugin, into your inherited theme's folder /user/themes/mytheme/templates/partials/.

  • In that copied file, on line 26, replace {{ native_name(language)|capitalize }} with {{ language|upper }}:

    Resulting in:

    TWIG
    <li><a href="{{ lang_url ~ uri.params }}" class="external{{ active_class }}">{{ language|upper }}</a></li>
    

Please note that you should make the changes in an inherited theme, else your changes will be lost when Langswitcher gets updated.

last edited 08/28/20 by pamtbaau

Suggested topics

Topic Participants Replies Views Activity
Plugins · by DrPen, 1 month ago
2 478 1 month ago
Plugins · by renedebaaij, 2 months ago
1 350 1 month ago
Plugins · by Thomas, 1 month ago
1 375 1 month ago
Plugins · by complanar, 2 months ago
6 699 2 months ago
Plugins · by BenLaKnet, 2 months ago
1 642 2 months ago