diff --git a/app/main.py b/app/main.py index 6929573..f46aaee 100644 --- a/app/main.py +++ b/app/main.py @@ -38,7 +38,7 @@ MODULE_LABELS: dict[str, str] = { "expense": "개인경비", "vacation": "휴가", "cupang": "쿠팡 밀크런", - "malaysia": "말레이시아 재고", + "malaysia": "말레이시아 재고관리", "expense_approver": "개인경비", "vacation_approver": "휴가", } @@ -294,7 +294,7 @@ def _menu_items_for(user_rec: dict[str, Any]) -> list[dict[str, Any]]: }, { "key": "malaysia", - "title": "말레이시아 재고", + "title": "말레이시아 재고관리", "subtitle": "Malaysia Stock", "description": "말레이시아 창고 입출고·세트 BOM·일일 재고조사를 관리합니다.", "url": "/malaysia/", diff --git a/app/static/malaysia.js b/app/static/malaysia.js index 9b163ac..1d3cd6e 100644 --- a/app/static/malaysia.js +++ b/app/static/malaysia.js @@ -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);