« get me outta code hell

most essential behavior for live-dev-server - 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>2023-01-09 21:07:16 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-01-09 21:07:16 -0400
commit594e8dd46f9e6cc74c680536a1d820eef27133f0 (patch)
treeb4dfeda6e32dfb09df6d3c6c52cccf88bf824005 /src/misc-templates.js
parent154c050db72ebf06d4514326c696ab43fb3f8dc8 (diff)
most essential behavior for live-dev-server
Diffstat (limited to 'src/misc-templates.js')
-rw-r--r--src/misc-templates.js43
1 files changed, 17 insertions, 26 deletions
diff --git a/src/misc-templates.js b/src/misc-templates.js
index 9a1bbf5..bccb883 100644
--- a/src/misc-templates.js
+++ b/src/misc-templates.js
@@ -971,46 +971,37 @@ function unbound_generateStickyHeadingContainer({
 
 function unbound_getFooterLocalizationLinks(pathname, {
   html,
+  defaultLanguage,
   language,
+  languages,
   to,
-  paths,
 
-  defaultLanguage,
-  languages,
+  pageSubKey,
+  urlArgs,
 }) {
-  const {urlPath} = paths;
-  const keySuffix = urlPath[0].replace(/^localized\./, '.');
-  const toArgs = urlPath.slice(1);
-
   const links = Object.entries(languages)
     .filter(([code, language]) => code !== 'default' && !language.hidden)
     .map(([code, language]) => language)
     .sort(({name: a}, {name: b}) => (a < b ? -1 : a > b ? 1 : 0))
     .map((language) =>
-      html.tag(
-        'span',
-        html.tag(
-          'a',
+      html.tag('span',
+        html.tag('a',
           {
             href:
               language === defaultLanguage
-                ? to('localizedDefaultLanguage' + keySuffix, ...toArgs)
+                ? to(
+                    'localizedDefaultLanguage.' + pageSubKey,
+                    ...urlArgs)
                 : to(
-                    'localizedWithBaseDirectory' + keySuffix,
-                    language.code,
-                    ...toArgs
-                  ),
+                    'localizedWithBaseDirectory.' + pageSubKey,
+                    language.code, ...urlArgs),
           },
-          language.name
-        )
-      )
-    );
-
-  return html.tag(
-    'div',
-    {class: 'footer-localization-links'},
-    language.$('misc.uiLanguage', {languages: links.join('\n')})
-  );
+          language.name)));
+
+  return html.tag('div', {class: 'footer-localization-links'},
+    language.$('misc.uiLanguage', {
+      languages: links.join('\n'),
+    }));
 }
 
 // Exports