From 6ec259a0e71174651bae95d4628138bf6fd68742 Mon Sep 17 00:00:00 2001
From: kj_sh604
Date: Sun, 15 Mar 2026 16:19:35 -0400
Subject: refactor: packages/

---
 packages/excalidraw/components/InitializeApp.tsx | 28 ++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 packages/excalidraw/components/InitializeApp.tsx

(limited to 'packages/excalidraw/components/InitializeApp.tsx')

diff --git a/packages/excalidraw/components/InitializeApp.tsx b/packages/excalidraw/components/InitializeApp.tsx
new file mode 100644
index 0000000..41f90ce
--- /dev/null
+++ b/packages/excalidraw/components/InitializeApp.tsx
@@ -0,0 +1,28 @@
+import React, { useEffect, useState } from "react";
+
+import { LoadingMessage } from "./LoadingMessage";
+import type { Language } from "../i18n";
+import { defaultLang, languages, setLanguage } from "../i18n";
+import type { Theme } from "../element/types";
+
+interface Props {
+  langCode: Language["code"];
+  children: React.ReactElement;
+  theme?: Theme;
+}
+
+export const InitializeApp = (props: Props) => {
+  const [loading, setLoading] = useState(true);
+
+  useEffect(() => {
+    const updateLang = async () => {
+      await setLanguage(currentLang);
+      setLoading(false);
+    };
+    const currentLang =
+      languages.find((lang) => lang.code === props.langCode) || defaultLang;
+    updateLang();
+  }, [props.langCode]);
+
+  return loading ? <LoadingMessage theme={props.theme} /> : props.children;
+};
-- 
cgit v1.2.3

