From 9d9ff0fce5bedcfe42d65d032aba4f4aec9653dc Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sun, 21 Jan 2024 02:51:25 -0800
Subject: fix(layout): locale reactivity

---
 src/routes/+layout.svelte | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

(limited to 'src/routes/+layout.svelte')

diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 505096b9..6a0163d2 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -13,7 +13,7 @@
 	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 { addMessages, init, _, locale } from 'svelte-i18n';
 	import english from '$lib/Locale/english';
 	import japanese from '$lib/Locale/japanese';
 	import type { LocaleDictionary } from '$lib/Locale/layout';
@@ -22,14 +22,9 @@
 
 	addMessages('en', english as unknown as LocaleDictionary);
 	addMessages('ja', japanese as unknown as LocaleDictionary);
+	init({ fallbackLocale: 'en', initialLocale: $settings.displayLanguage });
 
-	$: {
-		// import(`../lib/Locale/${$settings.displayLanguage}`).then((module) => {
-		// 	addMessages($settings.displayLanguage, module.default);
-		// });
-
-		init({ fallbackLocale: 'en', initialLocale: $settings.displayLanguage });
-	}
+	$: locale.set($settings.displayLanguage);
 
 	let currentUserIdentity = {
 		name: '',
-- 
cgit v1.2.3

