feat(malaysia): 메뉴명 '말레이시아 재고관리'로 변경 + 사이드바/헤더 영문 토글

- 메인 메뉴/라벨 '말레이시아 재고' → '말레이시아 재고관리'
- EN 토글 시 사이드바 활성 항목(말레이시아만)·상단 페이지 제목/부제 부분치환 번역
  (다른 메뉴는 그대로)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 18:49:46 +09:00
parent b18efcd814
commit 03929ff517
2 changed files with 34 additions and 3 deletions
+32 -1
View File
@@ -10,6 +10,9 @@
"use strict";
var KO_EN = {
// 사이드바 메뉴 / 페이지 제목
"말레이시아 재고관리": "Malaysia Stock",
"입고/출고/조정 일괄 등록": "IN/OUT/ADJUST bulk",
// 탭 / 공통
"재고 현황": "Stock Status",
"입출고": "In / Out",
@@ -73,6 +76,32 @@
var EN_KO = {};
Object.keys(KO_EN).forEach(function (k) { EN_KO[KO_EN[k]] = k; });
// 부분치환용 키 — 긴 키부터(부분 매칭 충돌 방지)
var RICH_KEYS = Object.keys(KO_EN).sort(function (a, b) { return b.length - a.length; });
// 헤더/사이드바처럼 .mys 밖이면서 KO 문구가 다른 텍스트와 섞인 요소.
// 사이드바는 현재 활성(말레이시아) 항목만 번역 → 다른 메뉴는 그대로 유지.
var RICH_SEL = [
".erp-topbar-title h1",
".erp-topbar-title p",
".erp-sidebar-item.is-active .erp-sidebar-label",
].join(",");
function applyRich(lang) {
document.querySelectorAll(RICH_SEL).forEach(function (el) {
if (el.getAttribute("data-o") === null) {
el.setAttribute("data-o", (el.textContent || "").trim());
}
var ko = el.getAttribute("data-o");
if (lang !== "en") { el.textContent = ko; return; }
var s = ko;
RICH_KEYS.forEach(function (k) {
if (s.indexOf(k) !== -1) s = s.split(k).join(KO_EN[k]);
});
el.textContent = s;
});
}
var SEL = [
".mys h1", ".mys h2", ".mys h3",
".mys th",
@@ -106,7 +135,9 @@
el.textContent = ko;
}
});
// 3) 토글 버튼 라벨
// 3) 헤더/사이드바(부분 치환)
applyRich(lang);
// 4) 토글 버튼 라벨
var btn = document.getElementById("mys-lang-toggle");
if (btn) btn.textContent = (lang === "en") ? "한글" : "ENG";
document.documentElement.setAttribute("data-mys-lang", lang);