Files
Aislo/M01_MasterData/M01_MasterData_UI_Logic_Text.ts
T
eomsangdonandClaude Opus 5.5 604ab2cb73 refactor(853-1): M01 화면 죽은 것 걷음 — 묶음 ①
- 지움: UI_Logic_Pick.ts(부르는 곳 0) · UI_Logic_Edit.ts(buildEditor · qtyKind 죽음 · 남은 formatNumber 는 공용 다시 내보내기뿐) · UI_Tree.ts(공용 트리 다시 내보내기 껍데기)
- Logic_Note: buildNote 와 그것만 쓰던 relatedFinds · matchRow · tableView 등 걷음(살아 있는 loadTable · explain 남김)
- LogicLab_Foot.FOOT_OF · Draft.fileCount 걷음(부르는 곳 0)
- 글 키: Logic_Text 62 · LogicLab_Text 11 걷음(정적 · 동적 부름 0 · typecheck 가 지킴)
- import 를 본래 자리로: formatNumber · formatMoney 등 → common_util_money · renderTree → @ui/ui_template_tree
- UI_Logic_Money.ts 는 남김 — M02 네 파일이 import(sub2 몫)
- 시험: test_782_1 소유 선택지 시험 지움(죽은 buildEditor 글만 봄) · test_208_1 · test_modal_top 경로 목록에서 Logic_Pick 줄 뺌 · helper_717_1 의 Logic_Edit 가짜 모듈 뺌

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:35:53 +09:00

127 lines
5.9 KiB
TypeScript

/* =============================================================================
* M01_MasterData_UI_Logic_Text.ts
* 로직 화면 글자 — [한국어, 영어] · 공용 사전과 같은 모양 · 창끼리 공용 사전 줄이 겹치지 않게 따로 둠
* ========================================================================== */
import { currentLanguageIndex } from "@ui/ui_template_locale";
const TEXT = {
Title: ["단가산출 기초", "Unit-price logic"],
List_Search: ["이름 · 별칭 찾기", "Search name or alias"],
List_Alias: ["별칭 — 쉼표로 여럿 · 고친 뒤 [저장]", "Aliases — comma separated · then [Save]"],
List_Blocked: ["막힘", "Blocked"],
List_Edited: ["고침", "Edited"],
List_New: ["새것", "New"],
List_Deleted: ["지움", "Deleted"],
List_Fold: ["{n} 줄 펼침 — 같은 절 · 작업량", "Show {n} more — same section · output"],
List_Unfold: ["접기", "Fold"],
List_Related: ["관련", "Related"],
List_RelatedTip: [
"비고가 가리키는 로직 — 계산 밖 · 누르면 열림",
"Logic named in the note — not in the calc · click to open",
],
Bar_Back: ["← 로직 목록", "← Logics"],
Bar_Delete: ["로직 삭제", "Delete logic"],
Bar_Save: ["저장", "Save"],
Bar_Discard: ["되돌림", "Revert"],
Bar_Pending: ["저장 안 한 로직 {n} 개", "{n} unsaved logics"],
Head_File: ["파일", "File"],
Head_Key: ["키", "Key"],
Head_Number: ["원문번호", "Source no."],
Head_Name: ["이름", "Name"],
Head_Unit: ["결과 단위", "Result unit"],
Head_Source: ["출처", "Source"],
Head_Revision: ["개정", "Revised"],
Head_Owner: ["소유", "Owner"],
Head_Note: ["비고", "Note"],
Head_Blocked: ["막힌 까닭", "Why blocked"],
Ho_Title: ["호표", "Unit-cost lines"],
Ho_Qty: ["수량", "Qty"],
Ho_Amount: ["금액", "Amount"],
Middle_Title: ["중간 값", "Intermediate values"],
Formula: ["식", "Formula"],
Calc_Title: ["시험 계산", "Test calculation"],
Calc_Run: ["계산", "Calculate"],
Calc_NoInputs: ["받을 값 없음", "No inputs"],
Calc_Draft: ["고친 줄로 계산(저장 전)", "Using unsaved edits"],
Calc_Stopped: ["멈춤", "Stopped"],
Calc_Result: ["결과", "Result"],
Calc_Sum: ["계", "Total"],
Pick_Title: ["요소 찾기", "Find element"],
Pick_Search: ["이름·키·원문번호", "Name · key · source no."],
Pick_Item: ["품목 고르기", "Pick item"],
Pick_Machine: ["기계 고르기", "Pick machine"],
Calc_UnitWarn: ["단위 다름", "Unit differs"],
Pick_Close: ["닫기", "Close"],
Mat_NoPrice: ["단가 없음", "No price"],
Save_Done: ["저장했음", "Saved"],
Save_Stale: [
"그 사이 파일이 바뀜 — 고친 것을 버리고 다시 여세요: {v}",
"Files changed meanwhile — discard and reopen: {v}",
],
Save_Errors: ["검사에 걸려 저장 안 함", "Check failed — nothing saved"],
Save_Failed: ["저장 못 함", "Save failed"],
Save_Nothing: ["고친 것 없음", "Nothing to save"],
Load_Failed: ["불러오지 못함", "Load failed"],
Lab_Title: ["단가산출 기초", "Unit-price logic"],
Loading: ["불러오는 중", "Loading"],
Confirm_Delete: [
"로직 「{v}」 을 지울까요? 로직 · 수식이 서버에서 바로 지워짐",
"Delete logic “{v}”? Logic and formula are removed on the server now",
],
Delete_Done: ["로직 「{v}」 지움", "Deleted logic “{v}”"],
Delete_Used: ["부르는 곳이 있어 못 지움", "In use — not deleted"],
Confirm_Discard: [
"저장 안 한 고친 것(기본정보 · 수식)을 버리고 저장 뒤 상태로 되돌릴까요?",
"Discard unsaved edits (info · formula) and revert to the saved state?",
],
/* ── 멈춘 까닭을 설계자 말로 ── */
Stop_Missing: [
"「{name}」 값을 아직 안 넣었습니다 — 값을 넣으면 계산됩니다",
"「{name}」 is empty — enter it to calculate",
],
Stop_NoRow: [
"넣은 값에 맞는 표 줄이 없습니다 — 값을 바꿔 보세요",
"No table row fits these values — try other values",
],
Stop_Spec: [
"「{name}」 규격이 여럿이라 정하지 못함 — 위 「쓰이는 재료·기계」에서 하나를 골라 주세요",
"「{name}」 has several specs — pick one in the materials list above",
],
Stop_Generic: [
"이 조건으로는 셈하지 못함 — 입력값 · 표에 그 조합이 있는지 확인",
"Cannot be calculated with these inputs — check the values and the table",
],
Stop_NoPrice: [
"「{name}」 단가가 자료에 비어 있어 셈하지 못함 — 자료를 채워야 함",
"「{name}」 has no price in the data yet",
],
} as const satisfies Record<string, readonly [string, string]>;
export type TextKey = keyof typeof TEXT;
/** 엔진이 멈춘 까닭을 설계자 말로 — 모르는 글은 그대로 */
export function plainReason(reason: string): string {
const missing = /입력 「([^」]+)」 없음/.exec(reason);
if (missing) return tx("Stop_Missing", { name: missing[1] });
if (/맞는 줄 0개/.test(reason)) return tx("Stop_NoRow");
const spec = /「([^」]+)」 후보 여럿/.exec(reason);
if (spec) return tx("Stop_Spec", { name: spec[1] });
const noPrice = /「([^」]+)」 값 없음/.exec(reason);
if (noPrice) return tx("Stop_NoPrice", { name: noPrice[1] });
return reason;
}
/** 화면에 찍는 까닭의 마지막 방어 — 중괄호 · 따옴표 · Decimal( 이 섞인 날글은 사람 말 한 줄로 */
export function safeReason(reason: string): string {
const plain = plainReason(reason);
return /[{}"']|Decimal\(/.test(plain) ? tx("Stop_Generic") : plain;
}
/** 공용 `t()` 와 같은 뜻 — `{n}`·`{v}` 는 채움 */
export function tx(key: TextKey, fill: Record<string, string | number> = {}): string {
const entry = TEXT[key];
const text: string = entry[currentLanguageIndex as 0 | 1] ?? entry[0];
return text.replace(/\{(\w+)\}/g, (m, k: string) => (k in fill ? String(fill[k]) : m));
}