ar-design 0.1.44 → 0.1.45
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.
|
@@ -88,13 +88,16 @@ export const useValidation = function (data, params) {
|
|
|
88
88
|
// Custom hook for easier usage of context
|
|
89
89
|
export const useTranslation = function (translations) {
|
|
90
90
|
const t = (key, ...args) => {
|
|
91
|
-
|
|
91
|
+
if (typeof window !== "undefined") {
|
|
92
|
+
return Utils.StringFormat(translations[localStorage.getItem("ar-language-value")][key], args);
|
|
93
|
+
}
|
|
94
|
+
return "";
|
|
92
95
|
};
|
|
93
96
|
const changeLanguage = (language) => {
|
|
94
|
-
if (typeof window
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
if (typeof window !== "undefined") {
|
|
98
|
+
localStorage.setItem("ar-language-value", language);
|
|
99
|
+
window.location.reload();
|
|
100
|
+
}
|
|
98
101
|
};
|
|
99
102
|
return { t, changeLanguage };
|
|
100
103
|
};
|