From 861c4086c6355f6551f6d1dccbf6d9766c6b1d15 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 10 May 2022 21:53:25 -0300 Subject: port the rest of everything --- src/misc-templates.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/misc-templates.js') 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'}, -- cgit 1.3.0-6-gf8a5