@inzombieland/core 1.18.34 → 1.18.35
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/composables/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { useActiveSessions } from "./use-active-sessions";
|
|
|
3
3
|
export { useApiActions } from "./use-api-actions";
|
|
4
4
|
export { useAppLocale } from "./use-app-locale";
|
|
5
5
|
export { useCookies } from "./use-cookies";
|
|
6
|
+
export { useDayjs } from "./use-dayjs";
|
|
6
7
|
export { useSubscribe } from "./use-subscribe";
|
|
7
8
|
export { useThemeMode } from "./use-theme-mode";
|
|
8
9
|
export { useUser } from "./use-user";
|
package/composables/index.mjs
CHANGED
|
@@ -3,6 +3,7 @@ export { useActiveSessions } from "./use-active-sessions.mjs";
|
|
|
3
3
|
export { useApiActions } from "./use-api-actions.mjs";
|
|
4
4
|
export { useAppLocale } from "./use-app-locale.mjs";
|
|
5
5
|
export { useCookies } from "./use-cookies.mjs";
|
|
6
|
+
export { useDayjs } from "./use-dayjs.mjs";
|
|
6
7
|
export { useSubscribe } from "./use-subscribe.mjs";
|
|
7
8
|
export { useThemeMode } from "./use-theme-mode.mjs";
|
|
8
9
|
export { useUser } from "./use-user.mjs";
|
package/init-application.mjs
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { StyleProvider, Themes, Locale as VarletLocale } from "@varlet/ui";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import localizedFormat from "dayjs/plugin/localizedFormat";
|
|
4
|
+
import relativeTime from "dayjs/plugin/relativeTime";
|
|
2
5
|
import { setNotifyDefaultOptions, Locale as VantLocale } from "vant";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
6
|
+
import VantLocaleEnUS from "vant/es/locale/lang/en-US";
|
|
7
|
+
import VantLocaleRuRU from "vant/es/locale/lang/ru-RU";
|
|
5
8
|
import { watch } from "vue";
|
|
6
9
|
import { useI18n } from "vue-i18n";
|
|
7
10
|
import { useRouter } from "vue-router";
|
|
@@ -54,14 +57,7 @@ function initApplication() {
|
|
|
54
57
|
if ("setLocale" in i18n && typeof i18n.setLocale === "function") {
|
|
55
58
|
i18n.setLocale(locale2?.value);
|
|
56
59
|
}
|
|
57
|
-
|
|
58
|
-
VantLocale.use("en-US", enUS);
|
|
59
|
-
VarletLocale.add("en-US", VarletLocale.enUS);
|
|
60
|
-
}
|
|
61
|
-
if (locale2?.value === "ru") {
|
|
62
|
-
VantLocale.use("ru-RU", ruRU);
|
|
63
|
-
VarletLocale.add("en-US", VarletLocale.enUS);
|
|
64
|
-
}
|
|
60
|
+
loadThirdPartyLocales(locale2?.value);
|
|
65
61
|
const localeCookie = useCookies("locale", { maxAge: 60 * 60 * 24 * 365 });
|
|
66
62
|
localeCookie.value = locale2?.value;
|
|
67
63
|
},
|
|
@@ -95,6 +91,39 @@ function initApplication() {
|
|
|
95
91
|
}
|
|
96
92
|
});
|
|
97
93
|
}
|
|
94
|
+
function loadThirdPartyLocales(locale) {
|
|
95
|
+
loadVantLocale(locale);
|
|
96
|
+
loadVarletLocale(locale);
|
|
97
|
+
loadDayjsLocale(locale);
|
|
98
|
+
}
|
|
99
|
+
function loadVantLocale(locale) {
|
|
100
|
+
if (locale === "en") {
|
|
101
|
+
VantLocale.use("en-US", VantLocaleEnUS);
|
|
102
|
+
}
|
|
103
|
+
if (locale === "ru") {
|
|
104
|
+
VantLocale.use("ru-RU", VantLocaleRuRU);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function loadVarletLocale(locale) {
|
|
108
|
+
if (locale === "en") {
|
|
109
|
+
VarletLocale.add("en-US", VarletLocale.enUS);
|
|
110
|
+
}
|
|
111
|
+
if (locale === "ru") {
|
|
112
|
+
VarletLocale.add("en-US", VarletLocale.enUS);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async function loadDayjsLocale(lang) {
|
|
116
|
+
let locale;
|
|
117
|
+
if (lang === "en") {
|
|
118
|
+
locale = await import("dayjs/locale/en");
|
|
119
|
+
}
|
|
120
|
+
if (lang === "ru") {
|
|
121
|
+
locale = await import("dayjs/locale/ru");
|
|
122
|
+
}
|
|
123
|
+
dayjs.locale(locale);
|
|
124
|
+
dayjs.extend(localizedFormat);
|
|
125
|
+
dayjs.extend(relativeTime);
|
|
126
|
+
}
|
|
98
127
|
export const createInitApplication = once(() => {
|
|
99
128
|
return () => initApplication();
|
|
100
129
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inzombieland/core",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.35",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"main": "./index.mjs",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"@vueuse/core": "^12.8.2",
|
|
16
16
|
"centrifuge": "^5.3.4",
|
|
17
17
|
"cookie-es": "^2.0.0",
|
|
18
|
+
"dayjs": "^1.11.13",
|
|
18
19
|
"destr": "^2.0.5",
|
|
19
20
|
"klona": "^2.0.6",
|
|
20
21
|
"ofetch": "^1.4.1",
|