diff --git a/public/themes/dist_static/static/js/common.js b/public/themes/dist_static/static/js/common.js
index 454efe1..6532e25 100644
--- a/public/themes/dist_static/static/js/common.js
+++ b/public/themes/dist_static/static/js/common.js
@@ -40,6 +40,70 @@ $(function() {
lenis.raf(time * 1e3);
});
gsap.ticker.lagSmoothing(0);
+
+ const UI_I18N = {
+ zh: {
+ "video.play": "视频播放",
+ "filter.by_product": "按产品筛选",
+ "about.expand_more": "展开更多",
+ "about.collapse": "收起",
+ "brand.short": "睿能科技",
+ "stock.delay_note": "截止 {time}*报价有十五分钟或以上延迟。",
+ "contact.name_required": "请输入姓名",
+ "contact.phone_required": "请输入手机号",
+ "contact.company_required": "请输入公司名称",
+ "contact.email_required": "请输入邮箱",
+ "contact.submitting": "提交中...",
+ "contact.submit": "提交",
+ "contact.success": "提交成功,我们会尽快与您联系!",
+ "contact.fail": "提交失败,请稍后重试",
+ "contact.network_error": "网络错误,请稍后重试",
+ "earth.hq_fuzhou": "全球总部福州",
+ "earth.hq_fuzhou_html": "全球总部
福州"
+ },
+ en: {
+ "video.play": "Video",
+ "filter.by_product": "Filter by product",
+ "about.expand_more": "Show more",
+ "about.collapse": "Show less",
+ "brand.short": "RAYNEN",
+ "stock.delay_note": "As of {time}* Quotes delayed by 15 minutes or more.",
+ "contact.name_required": "Please enter your name",
+ "contact.phone_required": "Please enter your phone number",
+ "contact.company_required": "Please enter your company name",
+ "contact.email_required": "Please enter your email",
+ "contact.submitting": "Submitting...",
+ "contact.submit": "Submit",
+ "contact.success": "Submitted successfully. We will contact you soon.",
+ "contact.fail": "Submission failed. Please try again later.",
+ "contact.network_error": "Network error. Please try again later.",
+ "earth.hq_fuzhou": "Global HQ Fuzhou",
+ "earth.hq_fuzhou_html": "Global HQ
Fuzhou"
+ }
+ };
+
+ function getUiLang() {
+ const fromHeader = document.querySelector(".site-header__lang")?.getAttribute("data-lang-current");
+ if (fromHeader === "en" || fromHeader === "zh") return fromHeader;
+ const seg = location.pathname.replace(/^\//, "").split("/")[0] || "";
+ return seg === "en" ? "en" : "zh";
+ }
+
+ function t(key, vars) {
+ const lang = getUiLang();
+ const table = UI_I18N[lang] || UI_I18N.zh;
+ let str = table[key] ?? UI_I18N.zh[key] ?? key;
+ if (vars && typeof vars === "object") {
+ Object.keys(vars).forEach((k) => {
+ str = str.replace(new RegExp(`\\{${k}\\}`, "g"), String(vars[k]));
+ });
+ }
+ return str;
+ }
+
+ window.getUiLang = getUiLang;
+ window.t = t;
+
const $header = $(".site-header");
const $mask = $(".mask");
const $targets = $("[data-header-dark]");
@@ -280,7 +344,7 @@ $(function() {
const timeEl = document.querySelector('[data-stock="time"]');
if (timeEl && data.updateTime) {
- timeEl.textContent = `截止 ${data.updateTime}*报价有十五分钟或以上延迟。`;
+ timeEl.textContent = t("stock.delay_note", { time: data.updateTime });
}
const chartEl = document.querySelector('#stock-chart, [data-stock="chart"]');