Fix languages not being sorted correctly

This commit is contained in:
Pk11 2022-03-20 16:23:55 -05:00
parent fd746e76a0
commit 6ceec5def8
2 changed files with 32 additions and 32 deletions

View File

@ -1,23 +1,23 @@
{ {
"da-DK": "Dansk", "Dansk": "da-DK",
"de-DE": "Deutsch", "Deutsch": "de-DE",
"en-US": "English", "English": "en-US",
"es-ES": "Español", "Español": "es-ES",
"fr-FR": "Français", "Français": "fr-FR",
"he-IL": "עברית", "עברית": "he-IL",
"hu-HU": "Magyar", "Magyar": "hu-HU",
"id-ID": "Bahasa Indonesia", "Bahasa Indonesia": "id-ID",
"it-IT": "Italiano", "Italiano": "it-IT",
"ja-JP": "日本語", "日本語": "ja-JP",
"ko-KR": "한국어", "한국어": "ko-KR",
"nl-NL": "Nederlands", "Nederlands": "nl-NL",
"no-NO": "Norsk", "Norsk": "no-NO",
"pl-PL": "Polski", "Polski": "pl-PL",
"pt-PT": "Português", "Português": "pt-PT",
"ru-RU": "Русский", "Русский": "ru-RU",
"sv-SE": "Svenska", "Svenska": "sv-SE",
"tr-TR": "Türkçe", "Türkçe": "tr-TR",
"uk-UA": "Українська", "Українська": "uk-UA",
"zh-CN": "中文 (简体)", "中文 (简体)": "zh-CN",
"zh-TW": "中文 (繁體)" "中文 (繁體)": "zh-TW"
} }

View File

@ -37,18 +37,18 @@
</svg> </svg>
</button> </button>
<ul class="dropdown-menu dropdown-menu-sm-end hover-content" id="language-dropdown"> <ul class="dropdown-menu dropdown-menu-sm-end hover-content" id="language-dropdown">
{% for collection in site.collections %} {% assign langs = site.data.lang-names | sort %}
{% unless collection.label == "ic-IC" %} {% for lang in langs %}
{% assign path = page.path | replace: page.collection, collection.label %} {% assign collection = site.collections | where_exp: "c", "c.label == lang[1]" | first %}
{% assign item = site[collection.label] | where: "path", path | first %} {% assign path = page.path | replace: page.collection, collection.label %}
{% if item %} {% assign item = site[collection.label] | where: "path", path | first %}
{% if item.lang != "en-US" or item.collection == "en-US" %} {% if item and item.lang != "en-US" or item.collection == "en-US" %}
<li><a class="dropdown-item {% if item.lang == page.collection %}active{% endif %}" lang="{{ item.lang }}" href="{{ item.url | remove: "index.html" | remove: ".html" }}" dir="{% if site.data.rtl contains item.collection %}rtl{%else%}ltr{% endif %}">{{ site.data.lang-names[item.lang] }}</a></li> <li><a class="dropdown-item {% if item.lang == page.collection %}active{% endif %}" lang="{{ item.lang }}" href="{{ item.url | remove: "index.html" | remove: ".html" }}" dir="{% if site.data.rtl contains item.collection %}rtl{%else%}ltr{% endif %}">{{ lang[0] }}</a></li>
{% endif %} {% endif %}
{% endif %}
{% endunless %}
{% endfor %} {% endfor %}
<li><hr class="dropdown-divider"></li> <li><hr class="dropdown-divider"></li>
{% assign path = page.path | replace: page.collection, "ic-IC" %} {% assign path = page.path | replace: page.collection, "ic-IC" %}
{% assign item = site.ic-IC | where: "path", path | first %} {% assign item = site.ic-IC | where: "path", path | first %}
{% if item %} {% if item %}