UNPKG

@matechat/core

Version:

前端智能化场景解决方案UI库,轻松构建你的AI应用。

115 lines (114 loc) 3.05 kB
import { ref as c, reactive as i } from "vue"; function u(s) { return new p(s); } let p = class { constructor(n) { this.locale = c("zh-cn"), this.messages = i({}), this.use = (e) => { this.locale.value = e; }, this.t = (e, o = {}) => { const t = this.messages[this.locale.value]; return g(e, o, t); }, this.mergeLocaleMessages = (e, o) => this.messages[e] ? (this.messages[e] = l(this.messages[e], o), l(this.messages[e], o)) : (this.messages[e] = o, this.messages), this.locale.value = n.locale, this.messages = i(n.messages); } }; function g(s, n, e) { const o = s.split("."); let t = e || {}; return o.forEach((a) => { t = t[a] ?? s; }), typeof t == "function" ? t(n) : t.replace(/{(\w+)}/g, (a, r) => n[r] ?? `{${r}}`); } function l(s, n) { const e = { ...s }; for (const o in n) if (Object.prototype.hasOwnProperty.call(n, o)) { const t = n[o], a = s[o]; typeof t == "object" && t !== null ? typeof a == "object" && a !== null ? e[o] = l(a, t) : e[o] = { ...t } : e[o] = t; } return e; } const w = { Input: { send: "Send", pauseAnswer: "Stop", pleaseEnter: "Please enter your question...", pleaseEnterPlaceholder: "Please enter your question and press {enterKey} to send, {shiftEnterKey} to wrap." }, Md: { toggle: "Collapse/Expand", copy: "Copy", diagram: "Diagram", code: "Code", zoomIn: "Zoom In", zoomOut: "Zoom Out", downLoad: "Download" }, Attachment: { dragToUpload: "Drag to upload" }, FileList: { uploadFailed: "Upload failed", downloadFailed: "Download failed", retry: "Retry", download: "Download", preview: "Preview", uploading: "Uploading...", downloading: "Downloading...", remove: "Remove", unsupportedPreview: "Browser does not support previewing this file type: {fileName}", tryDownload: "Please try downloading to view", close: "Close" } }, f = { Input: { send: "发送", pauseAnswer: "停止回答", pleaseEnter: "请输入您的问题...", pleaseEnterPlaceholder: "请输入您的问题,并按{enterKey}发送,按{shiftEnterKey}换行" }, Md: { toggle: "收起/展开", copy: "复制", diagram: "图形", code: "代码", zoomIn: "放大", zoomOut: "缩小", downLoad: "下载" }, Attachment: { dragToUpload: "拖拽到此处上传" }, FileList: { uploadFailed: "上传失败", downloadFailed: "下载失败", retry: "重试", download: "下载", preview: "预览", uploading: "上传中...", downloading: "下载中...", remove: "删除", unsupportedPreview: "浏览器不支持预览此文件类型:{fileName}", tryDownload: "请尝试下载后查看", close: "关闭" } }, h = { "en-us": w, "zh-cn": f }, d = u({ locale: "zh-cn", messages: h }); function v() { return d; } const M = { install: (s) => { s.config.globalProperties.McI18n = d; } }; export { M as McLocale, d as default, v as useMcI18n };