_검증_화면글.md 의 「사용자 확정 필요 없는 것만」 고침(브레인 판정) — 「단가산출 상세」 대 「호표」·「키」는 확정 거리라 그대로 둠. ① 자재 → 재료(LogicLab_Text.ts G_material) — 왼쪽 패널 묶음 이름과 맞춤. ② 결과단위 → 결과 단위 — Logic_Text.ts Head_Unit 뿐 아니라 화면을 열어 실제 표 머리글로 쓰이던 Logic_List.ts COLS 하드코딩 글자도 같이 고침 (점검 문서엔 안 적혀 있던 자리 — 화면 확인 중 찾음). ③ 죽은 글 지움 — locale_m1.ts M01_GroupTest(부르는 화면 코드 없음) · Logic_Text.ts Edit_OwnOnly·Edit_Copy·Edit_Copied·Edit_CopySoon (API 라는 프로그래머 말 포함, 다 같은 안 쓰이는 무리 — grep 으로 재확인 뒤 지움. 같은 이름의 로직개선시험 쪽 버튼은 살아 있어 안 건드림). typecheck(tsc --noEmit) 전후 0건. ORCA 로 화면 열어 확인 — 4곳 다 바뀐 글 그대로 보임. 390px 확인은 ORCA CLI 에 뷰포트 폭을 바꾸는 명령이 없어 못 함 (CSS 로 흉내내면 실제 media query 가 안 걸려 참값이 아님) — ref 문서에 그 사정과 글자수 견줌(줄바꿈 위험 낮음)을 적어 둠.
169 lines
7.7 KiB
TypeScript
169 lines
7.7 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"],
|
||
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"],
|
||
Lab_Title: ["로직 개선 시험", "Logic — improvement lab"],
|
||
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));
|
||
}
|