getgrav / grav-plugin-langswitcher

Grav LangSwitcher Plugin
https://getgrav.org
MIT License
28 stars 26 forks source link

How to display a short version of the language name like EN FR ES RU ... #37

Closed JOduMonT closed 2 years ago

JOduMonT commented 6 years ago

It's more than I'm not a developer and I learn by example but I didn't find anything to show me how to transform this line (I think it is in this line) : {{ native_name(language)|capitalize }}

Let's me try to explain what I expect :

I expect to have a EN / FR or en / fr menu which in html will look like : <a href="./en/">EN</a> / <a href="./fr/">FR</a>

instead of :

            <li>
            <a href="/en/blog.html" class="external">
                English
            </a>
        </li>
            <li>
            <a href="/fr/blog.html" class="external">
                Français
            </a>
        </li>

Thanks a lot :)

Jonathan

joelluethi commented 6 years ago

Hey Jonathan, I have the same problem/question and I am looking for a solution. Hope someone answers to this!

joelluethi commented 6 years ago

Hey @jodumont I found a solution, Instead of {{ native_name(language)|capitalize }} I wrote {{ key|upper }}. This now shows me the short version of the language name.

Hope this helps you too 👍 Joel

saidalkharusi commented 6 years ago

For me, {{ key|upper }} doesn't output anything. To show the short version I used {{ language|upper }}.

rhukster commented 2 years ago

Short version has been available for a while