/* ============================================================================= * M01_MasterData_UI_Logic_Text.ts * 로직 화면 글자 — [한국어, 영어] · 공용 사전과 같은 모양 · 창끼리 공용 사전 줄이 겹치지 않게 따로 둠 * ========================================================================== */ import { currentLanguageIndex } from "@ui/ui_template_locale"; const TEXT = { Title: ["일위대가 로직", "Unit-cost 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_New: ["로직 새로 만들기", "New logic"], 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"], CView_Title: ["로직 흐름 보기", "Logic — flow view"], Easy_Title: ["로직 쉽게 보기·만들기", "Logic — easy view & create"], 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"], /* ── 흐름 그림(기본 보기) ── */ View_Flow: ["흐름 그림", "Flow"], View_Advanced: ["고급 — 호표 표", "Advanced — table"], 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"], Guide_Flow: [ "왼쪽 「설계 값」을 넣으면 오른쪽으로 수량 → 단가 → 합계 순으로 흐름이 이어짐|상자를 누르면 값·출처·원문 표·쉬운 말 풀이가 펼쳐짐|빨간 글이 뜨면 그 까닭 그대로 값을 채우거나 바꿈", "Enter design values on the left; quantity, price and total follow to the right|Click a box for values, source, the source table and a plain-words reading|Red text says what is missing", ], /* ── 상자 속 설명 카드 ── */ 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"], Edit_OwnOnly: [ "정본 로직은 여기서 못 고침 — 「본떠 만들기」 로 내 것을 만든 뒤 고침", "Master logics are read-only here — use “Copy as mine” first", ], Edit_Copy: ["본떠 만들기", "Copy as mine"], Edit_Copied: ["내 로직 「{v}」 을 만들었음 — 여기서 고치면 됨", "Made your logic “{v}”"], Edit_CopySoon: [ "복제 길(API)이 아직 없음 — 서버가 준비되면 여기서 바로 됨", "The copy API is not ready yet", ], /* ── 멈춘 까닭을 설계자 말로 ── */ 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; 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; } /** 흐름 그림 머리 「이렇게 씀」 — 줄 목록 */ export const guideLines = (): string[] => tx("Guide_Flow").split("|"); /** 공용 `t()` 와 같은 뜻 — `{n}`·`{v}` 는 채움 */ export function tx(key: TextKey, fill: Record = {}): 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)); }