From 6ad0e36f4d46062db497cf06c882d1423925c998 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sat, 20 Jan 2024 02:00:45 -0800 Subject: feat: localisation --- src/routes/+layout.svelte | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'src/routes') diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 1118ebcf..bafc9272 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -13,9 +13,23 @@ import Notification from '$lib/Notification/Notification.svelte'; import Root from '$lib/Home/Root.svelte'; import root from '$lib/Utility/root'; + import { addMessages, init, _ } from 'svelte-i18n'; + import en from '$lib/locale/en.json'; + import ja from '$lib/locale/ja.json'; export let data; + addMessages('en', en); + addMessages('ja', ja); + + $: { + // import(`../lib/locale/${$settings.displayLanguage}.json`).then((module) => { + // addMessages($settings.displayLanguage, module.default); + // }); + + init({ fallbackLocale: 'en', initialLocale: $settings.displayLanguage }); + } + let currentUserIdentity = { name: '', id: -1, @@ -63,19 +77,21 @@