Closed utherbone closed 2 years ago
There are no options to use flags;
I have modified the code a bit since the first versions and it seems to work in the last, here it is:
https://github.com/getgrav/grav-plugin-langswitcher/blob/develop/templates/partials/langswitcher.html.twig
<style> a.active img { width: 30px !important; height 40px !important; } </style> <ul class="langswitcher"> {% set langobj = grav['language'] %} {% for key in langswitcher.languages %} {% if key == langswitcher.current %} {% set lang_url = page.url %} {% set active_class = ' active' %} {% else %} {% set lang_url = base_url_simple ~ langobj.getLanguageURLPrefix(key)~langswitcher.page_route ?: '/' %} {% set active_class = '' %} {% endif %} <li><a href="{{ lang_url ~ uri.params }}" class="external{{ active_class }}">{% if native_name(key) == 'Português (br)' %}{{ '<img width="20px" src="/images/langswitcher/br-flag.svg" />' }}{% else %}{{ '<img width="20px" src="/images/langswitcher/us-flag.svg" />' }}{% endif %}</a></li> {% endfor %} </ul>
I think it would be great to give some settings as a flag option for each language.
Flags are for countries not languages and are considered bad practice. closing.
There are no options to use flags;
I have modified the code a bit since the first versions and it seems to work in the last, here it is:
https://github.com/getgrav/grav-plugin-langswitcher/blob/develop/templates/partials/langswitcher.html.twig
I think it would be great to give some settings as a flag option for each language.