« get me outta code hell

port the rest of everything - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/misc-templates.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-05-10 21:53:25 -0300
committer(quasar) nebula <qznebula@protonmail.com>2022-05-10 21:53:25 -0300
commit861c4086c6355f6551f6d1dccbf6d9766c6b1d15 (patch)
tree317b35fbc4a5248e6bec84642bd0a6a5fb2cf289 /src/misc-templates.js
parent89ae8d37a9658da0be528e822a6e8116074334fb (diff)
port the rest of everything
Diffstat (limited to 'src/misc-templates.js')
-rw-r--r--src/misc-templates.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/misc-templates.js b/src/misc-templates.js
index 2e25a73..5aec92e 100644
--- a/src/misc-templates.js
+++ b/src/misc-templates.js
@@ -381,6 +381,7 @@ export function generatePreviousNextLinks(current, {
 // Footer stuff
 
 export function getFooterLocalizationLinks(pathname, {
+    defaultLanguage,
     languages,
     paths,
     language,
@@ -392,16 +393,13 @@ export function getFooterLocalizationLinks(pathname, {
 
     const links = Object.entries(languages)
         .filter(([ code ]) => code !== 'default')
-        .map(([ code, strings ]) => strings)
-        .sort((
-            { json: { 'meta.languageName': a } },
-            { json: { 'meta.languageName': b } }
-        ) => a < b ? -1 : a > b ? 1 : 0)
-        .map(strings => html.tag('span', html.tag('a', {
-            href: (strings.baseDirectory === languages.default.baseDirectory
+        .map(([ code, language ]) => language)
+        .sort(({ name: a }, { name: b }) => a < b ? -1 : a > b ? 1 : 0)
+        .map(language => html.tag('span', html.tag('a', {
+            href: (language === defaultLanguage
                 ? to('localizedDefaultLanguage' + keySuffix, ...toArgs)
-                : to('localizedWithBaseDirectory' + keySuffix, strings.baseDirectory, ...toArgs))
-        }, strings.json['meta.languageName'])));
+                : to('localizedWithBaseDirectory' + keySuffix, language.code, ...toArgs))
+        }, language.name)));
 
     return html.tag('div',
         {class: 'footer-localization-links'},