@tencentcloud/roomkit-web-vue3
Version:
<h1 align="center"> TUIRoomKit</h1> Conference (TUIRoomKit) is a product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education. By integrating this product, you can add room management,
52 lines (51 loc) • 1.54 kB
JavaScript
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const common = require("../utils/common.js");
const zhCN = require("./zh-CN.js");
const enUS = require("./en-US.js");
const Vue = require("vue");
const locale = Vue.ref("");
class TUIKitI18n {
constructor(options) {
__publicField(this, "messages");
__publicField(this, "global");
this.messages = options.messages;
locale.value = options.locale;
this.global = {};
this.global.locale = locale;
this.global.t = this.t.bind(this);
}
getNamed(option) {
return (key) => option[key] || key;
}
t(key, option) {
const message = this.messages[locale.value];
if (!message[key]) {
return key;
}
if (typeof message[key] === "function") {
const named = this.getNamed(option || {});
return message[key]({ named });
}
return message[key];
}
install() {
}
}
const i18n = new TUIKitI18n({
locale: common.getLanguage() || "zh-CN",
messages: {
"zh-CN": zhCN.default,
"en-US": enUS.default
}
});
function useI18n() {
return {
t: i18n.global.t.bind(i18n)
};
}
exports.default = i18n;
exports.useI18n = useI18n;
;