@liujitcn/kratos-admin-core 0.0.75 → 0.0.76
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/package/src/locales/index.ts +6 -0
- package/dist/package/src/rpc/base/v1/config.ts +1 -1
- package/dist/package/src/rpc/base/v1/file.ts +1 -1
- package/dist/package/src/rpc/base/v1/language.ts +1 -1
- package/dist/package/src/rpc/base/v1/login.ts +1 -1
- package/dist/package/src/rpc/base/v1/mfa.ts +1 -1
- package/dist/package/src/rpc/base/v1/oauth.ts +1 -1
- package/dist/package/src/rpc/base/v1/oauth_client.ts +1 -1
- package/dist/package/src/rpc/base/v1/secret_crypto.ts +1 -1
- package/dist/package/src/rpc/common/v1/common.ts +1 -1
- package/dist/package/src/rpc/common/v1/enum.ts +1 -1
- package/dist/package/src/rpc/common/v1/types.ts +1 -1
- package/dist/package/src/rpc/google/protobuf/empty.ts +1 -1
- package/dist/package/src/rpc/google/protobuf/struct.ts +1 -1
- package/dist/package/src/rpc/google/protobuf/wrappers.ts +1 -1
- package/dist/package/src/rpc/system/admin/v1/auth.ts +1 -1
- package/dist/package/src/rpc/system/admin/v1/base_dict.ts +1 -1
- package/dist/package/src/rpc/system/admin/v1/base_i18n.ts +1 -1
- package/dist/package/src/rpc/system/admin/v1/base_tenant.ts +1 -1
- package/dist/package/src/rpc/system/admin/v1/common.ts +1 -1
- package/dist/package/src/rpc/system/common/v1/common.ts +1 -1
- package/package.json +1 -1
|
@@ -40,6 +40,8 @@ const mutableLanguageOptions = ref<LocaleOption[]>([]);
|
|
|
40
40
|
const localeChangeHandlers = new Set<() => void | Promise<void>>();
|
|
41
41
|
const defaultLocaleMessages = new Map<SupportedLocale, LocaleMessages>();
|
|
42
42
|
const customLocaleMessages = new Map<SupportedLocale, LocaleMessages>();
|
|
43
|
+
// 语言包版本号:数据库自定义翻译热应用时递增,让缓存 t() 结果的 computed 依赖失效。
|
|
44
|
+
const localeMessagesVersion = ref(0);
|
|
43
45
|
|
|
44
46
|
/** 管理端 Vue I18n 实例。 */
|
|
45
47
|
export const adminI18n = createI18n({
|
|
@@ -109,6 +111,7 @@ export function registerLocaleMessages(modules: AdminModule[]): void {
|
|
|
109
111
|
customLocaleMessages.set(locale, messages);
|
|
110
112
|
adminI18n.global.setLocaleMessage(locale, messages);
|
|
111
113
|
});
|
|
114
|
+
localeMessagesVersion.value += 1;
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
/** 应用全部语言的数据库自定义翻译覆盖项。 */
|
|
@@ -122,6 +125,7 @@ export function applyCustomLocaleMessages(customs: Array<{ locale?: string; key?
|
|
|
122
125
|
customLocaleMessages.set(locale, messages);
|
|
123
126
|
adminI18n.global.setLocaleMessage(locale, messages);
|
|
124
127
|
});
|
|
128
|
+
localeMessagesVersion.value += 1;
|
|
125
129
|
}
|
|
126
130
|
|
|
127
131
|
/** 初始化持久化语言偏好并同步日期库。 */
|
|
@@ -188,6 +192,8 @@ export function registerLocaleChangeHandler(handler: () => void | Promise<void>)
|
|
|
188
192
|
|
|
189
193
|
/** 在非组件代码中翻译稳定语言键。 */
|
|
190
194
|
export function t(key: string, params: LocaleParams = {}): string {
|
|
195
|
+
// 读取版本号建立响应式依赖,自定义翻译热应用后缓存文案的 computed 能自动重算。
|
|
196
|
+
void localeMessagesVersion.value;
|
|
191
197
|
return String(adminI18n.global.t(key, params));
|
|
192
198
|
}
|
|
193
199
|
|