From a77c2e1c3827c381e2470612b2d626495bfefe10 Mon Sep 17 00:00:00 2001 From: Caroline Desprat Date: Mon, 7 Oct 2024 09:50:04 +0000 Subject: [PATCH] refactor: update useLocales composable --- src/composables/useLocale.js | 8 ++++++-- src/lang/fr.json | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/composables/useLocale.js b/src/composables/useLocale.js index ad4b336cc2..281d62400a 100644 --- a/src/composables/useLocale.js +++ b/src/composables/useLocale.js @@ -11,9 +11,13 @@ export function useLocale() { const locales = settings.locales const currentLocale = computed(() => find(locales, { key: locale.value })) // Watch for changes in the current locale and load the locale - watch(currentLocale, ({ key }) => core?.loadI18Locale(key)) + watch(currentLocale, async ({ key }, oldKey) => { + if (oldKey?.key !== key) { + await setLocale(key) + } + }) const setLocale = async (localeKey) => { - await core?.loadI18Locale(localeKey) + return core?.loadI18Locale(localeKey) } return { currentLocale, setLocale, locales } } diff --git a/src/lang/fr.json b/src/lang/fr.json index ccec4d9d36..b1288187ed 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -853,6 +853,27 @@ "submitError": "Impossible d'enregistrer ces paramètres.", "noAccess": "Vous n'avez pas accès à cette page en mode serveur." }, + "settings": { + "title": {"title": "Paramètres"}, + "general":{ + "title": "Général" + }, + "appearance": + { + "title": "Apparence" + }, + "languages": { + "title": "Langues" + }, + "addons": { + "plugins":{ + "title": "Plugins" + }, + "extensions":{ + "title": "Extensions" + } + } + }, "human": { "number": { "K": "%K",