Skip to content

Commit

Permalink
refactor: update useLocales composable
Browse files Browse the repository at this point in the history
  • Loading branch information
caro3801 committed Oct 7, 2024
1 parent e9ecf16 commit a77c2e1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/composables/useLocale.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
21 changes: 21 additions & 0 deletions src/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit a77c2e1

Please sign in to comment.