import { English } from "./chunk-I27RJOCH.js"; import { get_default } from "./chunk-R2OGZABH.js"; import { computed, inject, isRef, ref, unref } from "./chunk-AAHVYXXY.js"; // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/hooks/use-locale/index.mjs var buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale)); var translate = (path, option, locale) => get_default(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => { var _a; return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`; }); var buildLocaleContext = (locale) => { const lang = computed(() => unref(locale).name); const localeRef = isRef(locale) ? locale : ref(locale); return { lang, locale: localeRef, t: buildTranslator(locale) }; }; var localeContextKey = Symbol("localeContextKey"); var useLocale = (localeOverrides) => { const locale = localeOverrides || inject(localeContextKey, ref()); return buildLocaleContext(computed(() => locale.value || English)); }; export { buildTranslator, translate, buildLocaleContext, localeContextKey, useLocale }; //# sourceMappingURL=chunk-APPTXKCZ.js.map