From b135c097cf28f5ada86c5acdae019197ede1f6b7 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Fri, 3 Apr 2020 08:16:42 +0100 Subject: [PATCH] Add unicode flags for Language --- apps/locale/locale.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/locale/locale.html b/apps/locale/locale.html index 5d7882e00..5cb4b4598 100644 --- a/apps/locale/locale.html +++ b/apps/locale/locale.html @@ -56,7 +56,14 @@ exports = { name : "en_GB", currencySym:"£", }); var languageSelector = document.getElementById("languages"); - languageSelector.innerHTML = Object.keys(locales).map(l=>``).join("\n"); + languageSelector.innerHTML = Object.keys(locales).map(l=>{ + var localeParts = l.split("_"); // en_GB -> ["en","GB"] + var icon = ""; + // If we have a 2 char ISO country code, use it to get the unicode flag + if (localeParts[1] && localeParts[1].length==2) + icon = localeParts[1].toUpperCase().replace(/./g, char => String.fromCodePoint(char.charCodeAt(0)+127397) )+" "; + return `` + }).join("\n"); document.getElementById("upload").addEventListener("click", function() {