"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const resources$1 = require("./resources.cjs");
const resources = { us: resources$1.us, cn: resources$1.cn };
let currentLanguage = "us";
function setLanguage(lang) {
  currentLanguage = lang;
}
function interpolate(template, params) {
  if (!params) return template;
  return template.replace(/\{(.*?)\}/g, (_, k) => String(params[k] ?? ""));
}
function t(ns, key, params) {
  const langDict = resources[currentLanguage] ?? resources.us;
  const dict = langDict?.[ns];
  const value = dict?.[key];
  if (typeof value === "string") return interpolate(value, params);
  const fallback = resources.us[ns]?.[key];
  return typeof fallback === "string" ? interpolate(fallback, params) : key;
}
exports.setLanguage = setLanguage;
exports.t = t;
//# sourceMappingURL=index.cjs.map
