Closed kingemir closed 7 years ago
It gets it from an internal reference, you can't change it. But you can override the Twig https://github.com/getgrav/grav-plugin-langswitcher/blob/develop/templates/partials/langswitcher.html.twig#L14 in your theme, copying it to user/themes/yourtheme/templates/partials
and change it to, for example:
...
{% set lang_name = native_name(key) %}
{% if lang_name == 'zh' %}
{% set lang_name = '中文' %}
{% endif %}
<li><a href="{{ lang_url ~ uri.params }}" class="external{{ active_class }}">{{ lang_name|capitalize }}</a></li>
...
Could you please specify your answer, or provide the entire code for user/themes/yourtheme/templates/partials/langswitcher.html.twig
, because adding your code or replacing the initial code with your code doesn't provoke the desired result. Thanks.
Since the internal reference of the plugin contains wrong information, it should be fixed:
zh
(chinese) should display '中文'zh-Hant
(Chinese written using the Traditional Chinese script) should display '繁體中文'zh-Hans
(Chinese written using the Simplified Chinese script) should display '简体中文'These language tags follow the W3C standards (Language subtag plus Script subtag)
Hi,
the entire code below works. my language tag is cn and en. NOT zh-cn. PS: just change {% set lang_name = native_name(key) %} to {% set lang_name = native_name(language) %}
The entire code are:
for
zh
(chinese)is shown. That means simplified chinese. Where does the plugin get this information from? How can I let it show
(chinese) instead?
It's annoying especially when using
zh-cn
for traditional chinese, which shows