提交 22888252 编写于 作者: fxy060608's avatar fxy060608

feat(i18n): add getLocale

上级 78136217
...@@ -251,6 +251,9 @@ function initVueI18n(messages, fallbackLocale = 'en', locale) { ...@@ -251,6 +251,9 @@ function initVueI18n(messages, fallbackLocale = 'en', locale) {
t(key, values) { t(key, values) {
return t(key, values); return t(key, values);
}, },
getLocale() {
return i18n.getLocale();
},
setLocale(newLocale) { setLocale(newLocale) {
return i18n.setLocale(newLocale); return i18n.setLocale(newLocale);
}, },
......
...@@ -30,6 +30,7 @@ export declare interface I18nOptions { ...@@ -30,6 +30,7 @@ export declare interface I18nOptions {
export declare function initVueI18n(messages: LocaleMessages, fallbackLocale?: BuiltInLocale, locale?: BuiltInLocale): { export declare function initVueI18n(messages: LocaleMessages, fallbackLocale?: BuiltInLocale, locale?: BuiltInLocale): {
t(key: string, values?: Record<string, unknown> | unknown[] | undefined): string; t(key: string, values?: Record<string, unknown> | unknown[] | undefined): string;
getLocale(): BuiltInLocale;
setLocale(newLocale: BuiltInLocale): void; setLocale(newLocale: BuiltInLocale): void;
mixin: { mixin: {
beforeCreate(): void; beforeCreate(): void;
......
...@@ -247,6 +247,9 @@ function initVueI18n(messages, fallbackLocale = 'en', locale) { ...@@ -247,6 +247,9 @@ function initVueI18n(messages, fallbackLocale = 'en', locale) {
t(key, values) { t(key, values) {
return t(key, values); return t(key, values);
}, },
getLocale() {
return i18n.getLocale();
},
setLocale(newLocale) { setLocale(newLocale) {
return i18n.setLocale(newLocale); return i18n.setLocale(newLocale);
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册