From 7f93bd023495f11d4637d262b603d7691b6e76bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Marie=20De=20Mey?= Date: Wed, 5 Jun 2024 11:14:41 +0300 Subject: [PATCH] +currentLocale --- README.md | 1 - src/umd/client.ts | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7fb0e32..1ba369e 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,6 @@ error(key: string, error: string, spec: object): string - [SvelteKit](https://github.com/eddow/omni18n-svelte4) - Svelte4 - [Translator](https://github.com/eddow/omni18n-edit/releases) - To edit `FileDB` dictionaries - ## TODO - tests: diff --git a/src/umd/client.ts b/src/umd/client.ts index eff54f2..faa721e 100644 --- a/src/umd/client.ts +++ b/src/umd/client.ts @@ -89,6 +89,25 @@ export function translatePage() { localesListElm.innerHTML = selectionList.join('') } + + const currentLocaleElm = document.getElementById('current-locale') + if (currentLocaleElm) { + const flags = localeFlags(locale), + flagsStr = + flags.length === 1 + ? flags[0] + : ` + ${flags[0]} + ${flags[1]} +`, + localeName = new Intl.DisplayNames(locale, { type: 'language' }).of(locale) + currentLocaleElm.innerHTML = ` + +` + } } async function loadLanguage() {