mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
feat: [plugin-local] 添加 getLocal API 获取当前用户选择的语言
This commit is contained in:
parent
03fba1af2a
commit
8cfa16bc95
@ -57,6 +57,10 @@ const setLocale = ({ locale }) => {
|
|||||||
window.localStorage.setItem("fes_locale", locale);
|
window.localStorage.setItem("fes_locale", locale);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getLocale = () => {
|
||||||
|
return unref(i18n.global.locale)
|
||||||
|
}
|
||||||
|
|
||||||
const addLocale = ({ locale, messages }) => {
|
const addLocale = ({ locale, messages }) => {
|
||||||
messages[locale] = messages;
|
messages[locale] = messages;
|
||||||
if (isRef(i18n.global.messages)) {
|
if (isRef(i18n.global.messages)) {
|
||||||
@ -82,6 +86,7 @@ const t = (key) => {
|
|||||||
|
|
||||||
const locale = {
|
const locale = {
|
||||||
setLocale,
|
setLocale,
|
||||||
|
getLocale,
|
||||||
addLocale,
|
addLocale,
|
||||||
getAllLocales,
|
getAllLocales,
|
||||||
messages,
|
messages,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user