UNPKG

@qvant/qui-max

Version:

A Vue 3 Design system for Web.

22 lines (21 loc) 648 B
import { getConfig } from "../config.js"; import get from "../../../node_modules/lodash-es/get.js"; import isString from "../../../node_modules/lodash-es/isString.js"; let currentMessages = null; let i18nHandler = null; const t = (key, ...args) => { if (i18nHandler) return i18nHandler(key, ...args); const locale = getConfig("locale"); const text = get(currentMessages, `${locale}.${key}`); return isString(text) ? text : ""; }; const setI18n = (fn) => { i18nHandler = fn; }; const setMessages = (messages) => { if (messages) currentMessages = messages; }; export { setI18n, setMessages, t }; //# sourceMappingURL=index.js.map