Files
Aislo/M01_MasterData/M01_MasterData_UI_Logic_Text.ts
T
eomsangdonandClaude Sonnet 5 0eebf357fa feat(M01): PLAN 7-1 — 「로직 개선 시험」을 「단가산출 로직」 하나로 합침
소요량·계수의 쓰는 로직 · 조합 화면 로직 이름 · 패널 제목 세 자리를 모두
새 컨테이너(UI_LogicLab)로 돌림 · 옛 컨테이너(UI_Logic_Page)는 old_code/M01_MasterData/
로 옮김(지우지 않음 · import 경로만 고침 · 통째 복사 아님) · 정본 GC·GF 를 화면에서
바로 고쳐 저장 · 정본 파일에 빈 줄 더하기 두 길은 사용자 확정으로 버림.
분석 = resources/master_data/ref/_분석_로직컨테이너_통합.md.

typecheck 통과 · M01 시험 107 통과 · ORCA — 패널에 「단가산출 로직」 하나만
· 소요량 표 쓰는 로직 키(GF000002 · GF000051) 클릭 각각 그 로직이 새 컨테이너에서 열림
· 조합 화면 로직 이름도 같은 컨테이너로 이어짐.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WRFJmmhPi4exAzHgPZHMT
2026-09-22 12:08:54 +09:00

168 lines
7.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* =============================================================================
* M01_MasterData_UI_Logic_Text.ts
* 로직 화면 글자 — [한국어, 영어] · 공용 사전과 같은 모양 · 창끼리 공용 사전 줄이 겹치지 않게 따로 둠
* ========================================================================== */
import { currentLanguageIndex } from "@ui/ui_template_locale";
const TEXT = {
Title: ["단가산출 로직", "Unit-price logic"],
List_Search: ["이름 찾기", "Search name"],
List_AllBooks: ["원문 모두", "All sources"],
List_AllChapters: ["장 모두", "All chapters"],
List_BlockedOnly: ["막힘만", "Blocked only"],
List_Count: ["{n} 개", "{n} items"],
List_Blocked: ["막힘", "Blocked"],
List_Edited: ["고침", "Edited"],
List_New: ["새것", "New"],
List_Deleted: ["지움", "Deleted"],
Bar_Back: ["← 로직 목록", "← Logics"],
Bar_Delete: ["로직 지우기", "Delete logic"],
Bar_Save: ["저장", "Save"],
Bar_Discard: ["고친 것 버리기", "Discard edits"],
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_Owner: ["소유", "Owner"],
Head_Note: ["비고", "Note"],
Head_Blocked: ["막힌 까닭", "Why blocked"],
Inputs_Title: ["설계에서 받을 값", "Values from design"],
Inputs_Unit: ["단위", "Unit"],
Inputs_Choices: ["고르기(쉼표로)", "Choices (comma)"],
Inputs_Range: ["범위", "Range"],
Ho_Title: ["호표", "Unit-cost lines"],
Ho_Kind: ["종류", "Kind"],
Ho_Element: ["요소", "Element"],
Ho_Name: ["이름·규격", "Name · spec"],
Ho_Unit: ["단위", "Unit"],
Ho_Qty: ["수량", "Qty"],
Ho_Price: ["단가", "Unit price"],
Ho_Amount: ["금액", "Amount"],
Ho_Cost: ["비목", "Cost item"],
Ho_Pick: ["찾기", "Find"],
Ho_PickTable: ["표", "Table"],
Ho_QtyNumber: ["수", "Number"],
Ho_QtyTable: ["표 찾기", "Table lookup"],
Ho_QtyFormula: ["식", "Formula"],
Ho_PriceLater: ["계산 때", "At calc"],
Ho_Missing: ["없는 요소", "Missing element"],
Middle_Title: ["중간 값", "Intermediate values"],
Result_Title: ["결과 식(돈 아닌 로직)", "Result formula (non-money)"],
Extra_Title: ["덧줄", "Extra lines"],
Rounding: ["끝수", "Rounding"],
Formula: ["식", "Formula"],
AddRow: ["줄 더하기", "Add line"],
DeleteRow: ["줄 지우기", "Delete line"],
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_Total: ["{n} 개 중 앞 100 개", "first 100 of {n}"],
Pick_Close: ["닫기", "Close"],
Pick_All: ["(전체)", "(All)"],
Mat_Title: ["쓰이는 재료·기계", "Materials and machines"],
Mat_None: ["이 공종은 재료·기계를 따로 고르지 않습니다", "No materials or machines to pick"],
Mat_Default: ["기본 (원문 그대로)", "Default (as in source)"],
Mat_Price: ["단가", "Unit price"],
Mat_NoPrice: ["단가 없음", "No price"],
Enter_Value: ["값을 넣어 주세요", "Enter a value"],
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}”? Removed on save",
],
Confirm_Discard: ["고친 것을 모두 버릴까요?", "Discard all edits?"],
Confirm_Leave: [
"저장 안 한 로직이 있음 — 다른 로직을 열어도 고친 것은 남음",
"Unsaved logics stay in the draft",
],
New_Key: ["새 로직", "New logic"],
/* ── 흐름 그림(기본 보기) ── */
Flow_NoInputs: ["받을 값 없음", "No inputs"],
Flow_Other: ["그 밖", "Other"],
Flow_Sub: ["이 로직이 부르는 로직", "Logic called here"],
Flow_SubLines: ["호표", "Unit-cost lines"],
Col_입력: ["설계 값", "Design values"],
Col_중간: ["표 찾기", "Table lookup"],
Col_수량: ["수량", "Qty"],
Col_단가: ["× 단가", "× Unit price"],
Col_덧줄: ["할증·덧줄", "Extra lines"],
Col_비목: ["비목 합계", "Cost items"],
Col_계: ["계", "Total"],
/* ── 상자 속 설명 카드 ── */
Note_Plain: ["쉬운 말 풀이", "In plain words"],
Note_Table: ["원문 표 미리보기", "Source table"],
Note_TableMissing: ["{v} 표 못 찾음", "Table {v} not found"],
Note_Searching: ["찾는 중", "Looking up"],
Note_Formula: ["고급 — 식 그대로", "Advanced — raw formula"],
Note_ThisLine: ["이 줄", "This line"],
Use_Of: ["이 표의 용도", "Used for"],
/* ── 상자에서 고치기 ── */
Edit_On: ["고치기", "Edit"],
Edit_Off: ["고치기 끝", "Done"],
Edit_AddHo: ["호표 줄 더하기", "Add unit-cost line"],
Edit_AddInput: ["설계 값 더하기", "Add design value"],
Edit_AddMiddle: ["표 찾기 더하기", "Add table lookup"],
Edit_AddExtra: ["덧줄 더하기", "Add extra line"],
Edit_Qty: ["수량 식", "Qty formula"],
/* ── 멈춘 까닭을 설계자 말로 ── */
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_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;
}
/** 흐름 그림 머리 「이렇게 씀」 — 줄 목록 */
/** 공용 `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));
}