From 5c7bdca371433d65ac3ca0cb995795e0b28e0a11 Mon Sep 17 00:00:00 2001 From: qlin Date: Wed, 24 Jan 2024 16:44:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20[plugin-local]=20=E6=B7=BB=E5=8A=A0=20g?= =?UTF-8?q?etLocal=20API=20=E8=8E=B7=E5=8F=96=E5=BD=93=E5=89=8D=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E9=80=89=E6=8B=A9=E7=9A=84=E8=AF=AD=E8=A8=80=20(#228)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fes-plugin-locale/src/runtime/core.js.tpl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/fes-plugin-locale/src/runtime/core.js.tpl b/packages/fes-plugin-locale/src/runtime/core.js.tpl index abc0a820..42fd1708 100644 --- a/packages/fes-plugin-locale/src/runtime/core.js.tpl +++ b/packages/fes-plugin-locale/src/runtime/core.js.tpl @@ -57,6 +57,10 @@ const setLocale = ({ locale }) => { window.localStorage.setItem("fes_locale", locale); }; +const getLocale = () => { + return unref(i18n.global.locale) +} + const addLocale = ({ locale, messages }) => { messages[locale] = messages; if (isRef(i18n.global.messages)) { @@ -82,6 +86,7 @@ const t = (key) => { const locale = { setLocale, + getLocale, addLocale, getAllLocales, messages,