@ubean/i18n 0.4.4 → 0.4.6
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/dist/index.d.ts +20 -20
- package/dist/routing.d.ts +4 -4
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -15,45 +15,45 @@ interface I18nRequestScope {
|
|
|
15
15
|
n?: (value: number, ...args: unknown[]) => string;
|
|
16
16
|
}
|
|
17
17
|
type LocaleLoader = (code: string) => Promise<unknown>;
|
|
18
|
-
declare function setFallbackLocale(code: string): void;
|
|
19
|
-
declare function getFallbackLocale(): string;
|
|
20
|
-
declare function setLocaleMessages(code: string, messages: LocaleMessages): void;
|
|
21
|
-
declare function getLocaleMessages(code: string): LocaleMessages | undefined;
|
|
22
|
-
declare function mergeLocaleMessages(code: string, messages: LocaleMessages): LocaleMessages;
|
|
23
|
-
declare function setLocaleMeta(code: string, meta: {
|
|
18
|
+
export declare function setFallbackLocale(code: string): void;
|
|
19
|
+
export declare function getFallbackLocale(): string;
|
|
20
|
+
export declare function setLocaleMessages(code: string, messages: LocaleMessages): void;
|
|
21
|
+
export declare function getLocaleMessages(code: string): LocaleMessages | undefined;
|
|
22
|
+
export declare function mergeLocaleMessages(code: string, messages: LocaleMessages): LocaleMessages;
|
|
23
|
+
export declare function setLocaleMeta(code: string, meta: {
|
|
24
24
|
name?: string;
|
|
25
25
|
dir?: 'ltr' | 'rtl';
|
|
26
26
|
language?: string;
|
|
27
27
|
isDefault?: boolean;
|
|
28
28
|
}): void;
|
|
29
|
-
declare function getLocaleMeta(code: string): {
|
|
29
|
+
export declare function getLocaleMeta(code: string): {
|
|
30
30
|
name?: string;
|
|
31
31
|
dir: "ltr" | "rtl";
|
|
32
32
|
language?: string;
|
|
33
33
|
isDefault?: boolean;
|
|
34
34
|
} | undefined;
|
|
35
|
-
declare function listLocaleCodes(): string[];
|
|
36
|
-
declare function getRegisteredLocalesMeta(): Array<{
|
|
35
|
+
export declare function listLocaleCodes(): string[];
|
|
36
|
+
export declare function getRegisteredLocalesMeta(): Array<{
|
|
37
37
|
code: string;
|
|
38
38
|
name?: string;
|
|
39
39
|
dir: 'ltr' | 'rtl';
|
|
40
40
|
language?: string;
|
|
41
41
|
isDefault?: boolean;
|
|
42
42
|
}>;
|
|
43
|
-
declare function getLocaleDir(locale?: string): 'ltr' | 'rtl';
|
|
44
|
-
declare function getLocaleName(locale?: string): string | undefined;
|
|
43
|
+
export declare function getLocaleDir(locale?: string): 'ltr' | 'rtl';
|
|
44
|
+
export declare function getLocaleName(locale?: string): string | undefined;
|
|
45
45
|
/**
|
|
46
46
|
* Vite 图里的 `ubean:locales` 在求值时注册;Node 侧中间件通过
|
|
47
47
|
* `ensureLocaleMessages` 调用,避免 `import('ubean:locales')` 在 CLI 进程里 404。
|
|
48
48
|
*/
|
|
49
|
-
declare function registerLocaleLoader(loader?: LocaleLoader): void;
|
|
50
|
-
declare function ensureLocaleMessages(locale: string, fallback?: string): Promise<void>;
|
|
51
|
-
declare function createRequestContext(locale: string, fallback?: string): I18nCoreContext;
|
|
52
|
-
declare function runWithI18n<T>(scope: I18nRequestScope, fn: () => T): T;
|
|
53
|
-
declare function getI18nScope(): I18nRequestScope | undefined;
|
|
49
|
+
export declare function registerLocaleLoader(loader?: LocaleLoader): void;
|
|
50
|
+
export declare function ensureLocaleMessages(locale: string, fallback?: string): Promise<void>;
|
|
51
|
+
export declare function createRequestContext(locale: string, fallback?: string): I18nCoreContext;
|
|
52
|
+
export declare function runWithI18n<T>(scope: I18nRequestScope, fn: () => T): T;
|
|
53
|
+
export declare function getI18nScope(): I18nRequestScope | undefined;
|
|
54
54
|
declare function getRequestLocale(): string;
|
|
55
|
-
declare function t(key: string, ...args: unknown[]): string;
|
|
56
|
-
declare function d(value: Date | number | string, ...args: unknown[]): string;
|
|
57
|
-
declare function n(value: number, ...args: unknown[]): string;
|
|
55
|
+
export declare function t(key: string, ...args: unknown[]): string;
|
|
56
|
+
export declare function d(value: Date | number | string, ...args: unknown[]): string;
|
|
57
|
+
export declare function n(value: number, ...args: unknown[]): string;
|
|
58
58
|
//#endregion
|
|
59
|
-
export { type CompiledLocalePath, type HonoLocalePath, type I18nCoreContext, type I18nLocaleMeta, type I18nMiddlewareOptions, type I18nRequestScope, type I18nRoutingStrategy, type LocaleHeadInput, type LocaleHeadTags, type LocaleMessages, type LocaleRoutingConfig, buildLocaleHead, compileLocalePaths, createI18nMiddleware,
|
|
59
|
+
export { type CompiledLocalePath, type HonoLocalePath, type I18nCoreContext, type I18nLocaleMeta, type I18nMiddlewareOptions, type I18nRequestScope, type I18nRoutingStrategy, type LocaleHeadInput, type LocaleHeadTags, type LocaleMessages, type LocaleRoutingConfig, buildLocaleHead, compileLocalePaths, createI18nMiddleware, detectLocaleFromAcceptLanguage, extractLocaleFromPath, getRequestLocale as getAlsLocale, getPathWithoutLocale, getRequestLocale$1 as getRequestLocale, getVueLocaleParam, localizePath, parseLocaleCookie, serializeLocaleCookie, switchLocalePath, toVueRouterLocalePath };
|
package/dist/routing.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { a as switchLocalePath, d as I18nRoutingStrategy, i as localizePath, n a
|
|
|
2
2
|
import { UbeanEnv } from "@ubean/shared";
|
|
3
3
|
import { Context, MiddlewareHandler } from "hono";
|
|
4
4
|
//#region src/routing.d.ts
|
|
5
|
-
declare function createI18nMiddleware(options: I18nMiddlewareOptions): MiddlewareHandler<UbeanEnv>;
|
|
6
|
-
declare function getRequestLocale(c: Context): string;
|
|
7
|
-
declare function getPathWithoutLocale(c: Context): string;
|
|
5
|
+
export declare function createI18nMiddleware(options: I18nMiddlewareOptions): MiddlewareHandler<UbeanEnv>;
|
|
6
|
+
export declare function getRequestLocale(c: Context): string;
|
|
7
|
+
export declare function getPathWithoutLocale(c: Context): string;
|
|
8
8
|
//#endregion
|
|
9
|
-
export { type I18nMiddlewareOptions, type I18nRoutingStrategy, compileLocalePaths,
|
|
9
|
+
export { type I18nMiddlewareOptions, type I18nRoutingStrategy, compileLocalePaths, extractLocaleFromPath, localizePath, switchLocalePath };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ubean/i18n",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "i18n for ubean (vue-i18n / @intlify/core, compact locale routing, ALS)",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@intlify/core": "11.4.10",
|
|
28
|
-
"@ubean/shared": "0.4.
|
|
28
|
+
"@ubean/shared": "0.4.6",
|
|
29
29
|
"hono": "4.13.7"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^26.5.0",
|
|
33
|
-
"typescript": "
|
|
34
|
-
"vite-plus": "0.3.
|
|
33
|
+
"typescript": "npm:typescript-native-bridge@latest",
|
|
34
|
+
"vite-plus": "0.3.1"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=22"
|