From 2a5db3e7ab0a601245cac66f0f7be9226e6da8bf Mon Sep 17 00:00:00 2001 From: Nikhil Tanwar <2002nikhiltanwar@gmail.com> Date: Mon, 10 Jan 2022 23:28:07 +0530 Subject: [PATCH] Use iso6391to3.js for language tag value Improves upon the previous method of truncating language to first 2 values which was showing wrong values --- static/skin/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/static/skin/index.js b/static/skin/index.js index eb1388997..b6504dd18 100644 --- a/static/skin/index.js +++ b/static/skin/index.js @@ -114,12 +114,18 @@ ${downloadLink ? `
Download ${humanFriendlyZimSize ? ` - ${humanFriendlyZimSize}
`: ''}` : ''}
${description}
-
${language.substr(0, 2).toUpperCase()}
+
${getLanguageCodeToDisplay(language)}
${tagHtml}
`; return divTag; } + function getLanguageCodeToDisplay(langCode3Letter) { + const langCode2Letter = (Object.keys(iso6391To3).find(key => iso6391To3[key] === langCode3Letter)); + const res = (langCode2Letter != undefined) ? langCode2Letter : langCode3Letter; + return res.toUpperCase(); + } + function toggleFooter(show=false) { if (show) { footer.style.display = 'block';