@julseb-lib/react 0.1.83 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2283,15 +2283,19 @@ var useTouchScreen = () => {
|
|
|
2283
2283
|
|
|
2284
2284
|
// src/lib/hooks/useTranslation.tsx
|
|
2285
2285
|
import { useState as useState9, useEffect as useEffect7 } from "react";
|
|
2286
|
-
import
|
|
2286
|
+
import "@julseb-lib/utils";
|
|
2287
2287
|
var useTranslation = (translations) => {
|
|
2288
2288
|
const [language, setLanguage] = useState9("en");
|
|
2289
2289
|
const languages = Object.keys(translations);
|
|
2290
2290
|
useEffect7(() => {
|
|
2291
2291
|
if (window && typeof window !== "undefined") {
|
|
2292
|
-
|
|
2292
|
+
if (localStorage.getItem("lang")) {
|
|
2293
|
+
setLanguage(
|
|
2294
|
+
localStorage.getItem("lang")?.split("-")[0].toLowerCase() ?? "en"
|
|
2295
|
+
);
|
|
2296
|
+
}
|
|
2293
2297
|
}
|
|
2294
|
-
}, [
|
|
2298
|
+
}, []);
|
|
2295
2299
|
const translate = (key) => translations?.[language]?.[key];
|
|
2296
2300
|
return {
|
|
2297
2301
|
translate,
|