Skip to content

Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.

37.5 KB
Raw Blame
// SPDX-License-Identifier: Apache-2.0
// curator/i18n.js — 문자열 사전(en/ko) + 언어 상태 + 정적 라벨 적용
// 로드 순서 SSoT = index.html (classic script 전역 어휘 공유; 빌드 스텝 없음)

const STR = {
  en: {
    title: "curation", compose: "Download atlas", export: "Download PNGs", exportGif: "Download GIFs",
    groundGrid: "Ground grid", langOther: "한국어",
    unfakeApply: "Pixel unfake (all)", baseNote: "identity reference — not baked",
    unfakeState: "Pixel unfake",
    tUnfakeState: "toggle pixel-unfake for THIS row only — what it displays and what compose bakes",
    pxGrid: "Pixel grid", pxGridAll: "Pixel grid (all)",
    tGridState: "grid overlay for THIS row — output pixel raster on the pixel-unfake view; on the original view the FINAL correspondence grid (green): one cell = one result pixel (display only)",
    refsLabel: "generated from", ref_anchor: "direction anchor", ref_basis: "basis row", ref_guide: "layout guide", tPxGrid: "toggle the pixel-grid overlay for ALL rows at once (display only; each row has its own checkbox)",
    tUnfakeApply: "toggle pixel-unfake for ALL rows at once (each row has its own checkbox)",
    frames: "frames", loop: "loop", nonLoop: "non-loop", preview: "Preview",
    excluded: "✗ exclude", selected: "✓ selected", extractFail: "⚠ extraction incomplete",
    editing: "editing…", saved: "saved", saveFail: "save failed: ",
    saveLostBanner: "EDITS ARE NOT SAVING — the server may have restarted. Reload this page (your unsaved edits will be lost, but new edits will save again).",
    rowGif: "GIF", tRowGif: "download this row's current composed sequence as a GIF (4x nearest upscale for crisp viewing — pixel data unchanged)",
    tRowDl: "download this row's current composed sequence — GIF (server bake, 4x) / WebM (alpha) / MP4 (white background)",
    rowDlDone: (s, f) => `${s}.${f} downloaded`,
    tHandTool: "hand — drag to pan the view. Hold Space anywhere for a temporary hand (release to return)",
    rowReroll: "Reroll", tRowReroll: "reroll this row once more and APPEND it as candidates (rerollN take) — the current frames are kept; the new roll's frames arrive labeled next to them. Click opens the model popover (same idiom as Tween); Generate runs a full-batch re-extract, then the view reloads.",
    rerollBusy: (s) => `${s}: rerolling… (generation + full re-extract, a few minutes)`,
    rerollDone: (s) => `${s}: reroll appended to candidates — reloading`,
    rerollFail: "reroll failed: ",
    tRenameHint: "double-click the badge to name this instance",
    renamePrompt: "Instance name (empty to clear):",
    cmpOpen: "Compare", tCmpOpen: "compare the direction idle anchors on one canvas — side-by-side / overlay, shared ground line, click to add draggable guides",
    tCmpPlay: "play/stop every sprite (own sequence, fps and breathing layer included)", atlasBake: "bake now", tAtlasBake: "re-bake the atlas from the CURRENT curated state (sequence, transforms, pixel edits, breathing) and refresh this section — no download",
    atlasBaking: "baking…", atlasBaked: "atlas re-baked from the current curated state",
    atlasStale: "edits not baked yet", atlasBakeFail: "bake failed: ",
    tCmpGif: "download the compare canvas as a looping GIF (current layout + playback, deterministic virtual-time sampling)",
    cmpGifDone: "compare GIF downloaded", cmpGifFail: "compare export failed: ",
    cmpDl: "Save", tCmpDl: "download the compare canvas as an animation — pick GIF / WebM (alpha) / MP4 (white background) from the popover (current layout + playback, deterministic virtual-time sampling)",
    cmpDlAlpha: "transparent", cmpDlWhite: "white bg", cmpDlDone: (f) => `compare ${f} downloaded`,
    cmpMarks: "landmarks", tCmpMarks: "auto-detect body landmarks (head top, chin, cape start, belt, hem, feet) from palette signals of the first visible sprite and add them as horizontal guides",
    cmpMarksDone: (n) => `${n} landmark guides added`, cmpMarksNone: "no sprite to detect landmarks from",
    cmpGuidesHide: "hide guides", cmpGuidesShow: "show guides", cmpGuidesClear: "clear guides",
    tCmpGuidesToggle: "hide/show all guide lines (they are kept, just hidden)",
    tCmpGuidesClear: "delete ALL guide lines (undo with Cmd/Ctrl+Z)",
    cmpTitle: "Compare", cmpH: "horizontal", cmpV: "vertical", cmpOverlay: "overlay",
    cmpHint: "left list toggles sprites · drag a sprite to move it freely · empty click = horizontal guide, Shift+click = vertical · click a guide to focus, drag to move, Delete to remove · wheel = zoom · Cmd/Ctrl+Z undo · alignment buttons reset positions",
    cmpNone: "no extracted idle anchors to compare",
    seqCount: (play, src) => `${play} play · ${src} art`,
    tRelink: "independent duplicate (own edits) — click to RELINK to the source frame: its own edits are DISCARDED and it follows the source again",
    relinked: (s) => `relinked to ${s} — follows the source edits again`,
    tUnlink: "linked duplicate — edits sync with the source frame. Click to UNLINK into an independent frame (copies the current edits; further edits are separate)",
    unlinked: (s) => `unlinked from ${s} — now an independent frame`,
    tFpsStepper: "whole-row playback speed (state fps, saved to sprite-request) — per-frame hold time is expressed by duplicating frames (atlas cells are shared, so clones cost nothing)",
    fpsSet: (s, f) => `${s}: ${f}fps`, fpsFail: "fps change failed: ",
    rowBreathe: "Breathe", tRowBreathe: "breathing is a POST-PROCESS LAYER, orthogonal to frame selection — a blink frame breathes too. Check: turn it on (instant, saved to the sidecar; compose/GIF bake it deterministically). Uncheck: turn it off. Click the label to drag the rigid boundary and tune the width / height range and breaths over the LIVE playing sequence.",
    tRowBreatheEdit: "open the breathing editor — adjustments apply instantly over the playing sequence; Esc restores the previous setting",
    breatheWidth: "width", breatheHeight: "height", breatheMin: "min: the smallest the breath gets on this axis",
    breatheMax: "max: the largest the breath gets on this axis",
    tBreatheWidth: "how much the torso widens at the row where the breath is fullest, as a share of the original (0 = original width, -20..20%). Pixel: the widest moment is also the lowest head",
    tBreatheHeight: "how far the head top (smooth: the chest) rises, as a share of the body below the neck (negative = down, 0 = original height, -20..20%)",
    breatheCountLabel: "breaths/loop", breatheFitted: (n) => n === 0 ? "→ no room to breathe" : `→ ${n} applied`,
    breatheAuto: "auto", tBreatheAuto: "drop the manual boundary and use the detected one (neck bottleneck, or below the face when the face sits on the body)",
    tBreatheFitted: (len) => `the loop is ${len} frames — add frames to the sequence for a smoother breath`, tBreatheCount: "breath count per loop (1-8) — phases are continuous, so the requested count applies exactly",
    
        breatheHint: "drag the rigid boundary — everything above it stays bit-identical, the body below squashes and stretches, and the head follows a beat later. Applies instantly; Cmd/Ctrl+Z steps back/forward, Esc restores.",
    breatheRecalc: "recalculating\u2026",
    breatheAxisHint: "drag the body axis — the vertical centre column that never moves while breathing. Torso width lines mirror around it.",
    breatheTorsoHint: "drag the torso half-width — outside these lines counts as appendage (arms/wings): pushed sideways, never stretched. Drag inward to protect more.",
    breatheFail: "breathe failed: ",
    breatheResample: (rows) =>
      `heads-up: ${rows} has a rotate/scale transform. the bake resamples smoothly, this canvas `
      + `NEAREST — the exported file will differ from the GIF by a few edge pixels.`,
    opProgress: (p, pct) => `re-deriving ${p.done}/${p.total} (${pct}%) — ${p.label} · ${p.phase}`,
    healTitle: "Updating frames for the new engine",
    healNote: "Sorry for the wait~ this only happens once per engine update. We'll open right up when it's done!",
    healWaiting: "getting ready~",
    breatheStrip: (n, actual) => `final bake: ${n}-frame loop (unchanged) · ${actual} breath(s)`,
    breatheStripOff: (n) => `final bake: ${n}-frame loop · breathing off`,
    breatheOn: (s) => `${s}: breathing layer on`,
    breatheOff: (s) => `${s}: breathing layer off`,
    rowTween: "Tween", tRowTween: "AI in-between: generate a mid frame between two frames of this row (codex/grok image gen on the server machine's CLI auth) — recorded as a take, then the FULL batch re-extracts. Click cards to pick the pair.",
    tweenFrom: "from", tweenTo: "to", tweenT: "t", genGo: "Generate",
    tweenBusy: "interpolating + re-extracting the full batch… (1-2 min)",
    tweenDone: (s) => `${s}: in-between added — reloading`,
    tweenFail: "interpolation failed: ",
    treeAtlas: "final atlas", atlasDoc: "manifest.json (runtime doc)",
    atlasPending: "not composed yet — created when you download the atlas",
    atlasStamp: (d) => `computed ${d}`, tTreeAtlas: "scroll to the final atlas section",
    rcTitle: "colourways", treeRecolor: "variants/", treeRecolorNote: "baked colourways",
    tTreeRecolor: "scroll to the colourway section",
    rcBase: "base (no swap)", rcPick: "adopt", rcPicked: "✓ adopted", rcMissing: "sheet missing",
    rcMeta: (n, match, tol) => `${n} variants · ${match}${match === "tolerance" ? ` ±${tol}` : ""} match · variants/`,
    rcVariantNote: (sub, pass) => `${sub} px swapped · ${pass} px passed through`,
    rcUnusedSources: (list) => `map sources that matched nothing: ${list.join(", ")}`,
    rcPickUnknown: (name) => `adopted colourway "${name}" is not in the current bake — re-bake it or adopt another (the pick is kept, not cleared)`,
    rcPickSaved: (name) => `adopted colourway: ${name}`, rcPickCleared: "colourway pick cleared",
    tRcSection: "colour variants baked by `sprite-gen recolor` into <run-dir>/variants — the sheets are what the runtime loads, so what you compare here is what ships",
    tRcThumb: "hover to swap the big view to this sheet in place (a one-pixel colour difference only shows when the images swap at the same spot) — click to keep it there",
    tRcPick: "record this colourway as the adopted one in curation.json (click again to clear) — the sheets on disk are untouched",
    rowGifDone: (s) => `${s}.gif downloaded`,
    baking: "computing…", composeDone: "atlas downloaded", composeFail: "download failed: ",
    exporting: "computing…", exportFail: "download failed: ",
    ready: "ready", loaded: "loaded existing curation", runLoadFail: "failed to load run:",
    tRotate: "rotate", tShear: "shear — horizontal = shx, vertical = shy", tReset: "reset transform", tFlipX: "flip horizontally — a tool action, not a toggle: each press flips. With a marquee selection it flips ONLY that region's pixels (Cmd/Ctrl+Z undoes per press); without one, the whole frame",
    tReorder: "grab the title to drag — reorder, or move between sequence ⇄ pool. use 넣기/빼기 to toggle without dragging",
    tPlay: "play", tPause: "pause", tPrev: "step back", tNext: "step forward", tSpeed: "playback speed",
    zoneSeq: "Running sequence", zonePool: "Candidate pool — drag a cut up to add it", addToSeq: "add", removeFromSeq: "remove",
    tSelAdd: "add to the running sequence (move up)", tSelRemove: "remove to the candidate pool (move down)",
    tTitleCopy: "full name — select to copy (drag the title to reorder)",
    cellPx: "cell", tContentPx: "actual sprite pixels (transparent padding excluded)",
    tZoomOpen: "inspect large (double-click the image works too)",
    tZoomStage: "wheel/pinch = view zoom · Space/middle-drag = pan · drag = move sprite · corner resize control = sprite scale",
    tViewZoomIn: "view zoom in (magnifier — screen scale only, the sprite itself is untouched)",
    tViewZoomOut: "view zoom out",
    tViewZoomFit: "fit the view to the window and re-center",
    zoomClose: "✕", tZoomPrev: "previous frame", tZoomNext: "next frame",
    dirAnchorBadge: "direction anchor",
    tDirAnchorBadge: "canonical facing anchor for this direction — generated from the base; every other row of this direction derives identity from it",
    anchorFrameBadge: "ANCHOR",
    anchorFrameStaleBadge: "ANCHOR?",
    tAnchorFrameStale: "this pin can no longer be proven to point at the frame you approved (its row was regenerated, or it carries no generation stamp). Generation fails loud until you re-pin — click the pin button on the frame you want",
    tRepinAnchorFrame: "re-pin THIS frame as the direction anchor (clears the stale pin and stamps it for the current generation)",
    tAnchorFrameBadge: "this exact frame — as curated (pixel edits, transforms) — is the identity attached when generating the other rows of this direction. It follows the sequence head, so reordering or deleting frames can move it; pin it to lock it",
    tAnchorFramePinned: "pinned as this direction's anchor — it stays this frame even if you reorder or delete other frames",
    tSetAnchorFrame: "pin this frame as the direction anchor: the other rows of this direction are generated from THIS curated frame, and it stops following the sequence head",
    tUnsetAnchorFrame: "unpin the anchor frame (back to the anchor row's first sequence frame)",
    anchorPinned: (d, label) => `direction ${d} anchor = ${label}`,
    anchorUnpinned: (d, label) => `direction ${d} anchor back to the default (${label})`,
    anchorError: (d, msg) => `direction ${d} anchor unresolved: ${msg}`,
    dirGroupLabel: (d) => `direction · ${d}`,
    dirMirrorLabel: (d, src) => `direction · ${d} — runtime mirror of ${src} (not generated)`,
    treeTitle: "generation structure",
    treePipeline: "pipeline",
    treeFiles: "files",
    treeBaseNote: "base — first identity truth",
    treeIdleRow: "idle row",
    treeAnchorNote: "anchor · single frame-0 crop",
    treeMirror: (d, src) => `${d} — runtime mirror of ${src} (not generated)`,
    treePending: "not generated yet",
    treeRawNote: "raw · awaiting extract",
    missingPending: "not generated",
    archiveChip: (n) => `archive ${n}`,
    tArchiveChip: "click to open — drop a card here to archive it",
    tArchiveBtn: "archive (remove even from the candidate pool)",
    tScaleScrub: "sprite scale — click arrows to step, drag the resize icon left/right (view zoom is the magnifier widget)",
    penTool: "pen", eraserTool: "eraser", pickTool: "eyedropper", undoEdit: "undo", redoEdit: "redo", clearEdits: "clear edits",
    selectTool: "select", tSelectTool: "marquee: drag to select an area (dashed box) - drag inside to MOVE it, Alt+drag to DUPLICATE, Esc to deselect",
    transformTool: "transform", lassoTool: "lasso",
    tLassoTool: "lasso: drag a freehand loop to select a non-rectangular area, then it hands off to the transform tool. Esc to deselect",
    lassoSelected: (n) => `lasso: ${n} px selected - drag to move, Shift+drag to rotate, Alt+drag to skew`,
    tTransformTool: "transform (default): drag to move - Shift+drag to ROTATE, Alt+drag to SKEW. With a marquee selection it transforms ONLY that area (baked to pixels); with no selection it transforms the whole cell",
    regionTransformed: "region transformed (baked to pixel edits - undo with Cmd/Ctrl+Z)",
    tUndoKeys: "undo (Cmd/Ctrl+Z)", tRedoKeys: "redo (Cmd/Ctrl+Shift+Z)",
    baseEditBtn: "edit", tBaseEdit: "pixel-edit the base image itself — saves into base-source (original backed up once as .orig); affects FUTURE generation, not already-extracted frames",
    baseEditSave: "save to base", baseEditFail: "base save failed: ",
    baseUnsaved: "editing base — press 'save to base' to bake into the file",
    baseEditSaved: (n) => `base updated (${n}px) — affects future generation`,
    tPick: "eyedropper — click a pixel to sample its color, then it switches to the pen so you can paint that exact color",
    archiveHint: "drag a card out to restore it into the sequence or pool",
    archModalTitle: (st, n) => `archive · ${st} (${n})`,
    restoreToSeq: "to sequence", restoreToPool: "to pool",
    missingRawWait: "generated · awaiting extract",
    treeRawFolder: "generated strip originals",
    treeFramesFolder: "extracted frames",
    treeAnchorsFolder: "direction anchors — single-frame crops",
    treeAtlasNote: "final atlas",
    treeFrameCount: (n) => `${n} frames`,
    treeAnchorOrigin: (d) => `idle row · ${d} anchor source`,
    reloadBanner: "run updated — click to reload the view",
    tDupBtn: "duplicate this frame — a new card with its own transform (bakes the same source image)",
    cloneBadge: (name) => `${name} copy`,
    tCloneBadge: "duplicated instance — reads the source frame's image; its transform/pixel edits are its own. The archive button removes the copy entirely.",
    curationDropped: (states) =>
      `frames were regenerated — previous curation for ${states.join(", ")} no longer applies and was reset. ` +
      `curation.json on disk is untouched; the next save preserves it as curation.stale-<hash>.json.`,
    tTreeNode: "click to scroll to this row",
    hints: ["drag card header = reorder / move row", "drag pool→sequence to add", "hover a frame -> bottom-right magnifier = scale", "top handle = rotate", "click card = sequence ⇄ pool", "saved automatically"],
    exportDone: () => "PNGs downloaded",
    exportGifDone: () => "GIFs downloaded",
  },
  ko: {
    title: "큐레이션", compose: "아틀라스 다운로드", export: "PNG 다운로드", exportGif: "GIF 다운로드",
    groundGrid: "바닥 그리드", langOther: "EN",
    unfakeApply: "픽셀 언페이크 전체", baseNote: "원본 베이스 (아이덴티티 참조 — 굽기와 무관)",
    unfakeState: "픽셀 언페이크",
    tUnfakeState: "이 줄만 픽셀 언페이크 켜기/끄기 — 표시와 굽기가 같이 바뀐다",
    pxGrid: "픽셀 격자", pxGridAll: "픽셀 격자 전체",
    tGridState: "이 줄 격자 오버레이 — 픽셀 언페이크 뷰에선 출력 픽셀 눈금, 원본 뷰에선 최종 대응 격자(초록, 칸 하나 = 결과 픽셀 하나) (표시 전용)",
    refsLabel: "생성 재료", ref_anchor: "방향 앵커", ref_basis: "basis row", ref_guide: "레이아웃 가이드", tPxGrid: "모든 줄의 격자 오버레이를 한번에 켜기/끄기 (표시 전용; 줄별 체크박스는 각 줄에)",
    tUnfakeApply: "모든 줄의 픽셀 언페이크를 한번에 켜기/끄기 (줄별 체크박스는 각 줄에)",
    frames: "프레임", loop: "루프", nonLoop: "비루프", preview: "프리뷰",
    excluded: "✗ 제외", selected: "✓ 선택됨", extractFail: "⚠ 추출 미완료",
    editing: "편집 중…", saved: "저장됨", saveFail: "저장 실패: ",
    saveLostBanner: "편집이 저장되지 않고 있습니다 — 서버가 재기동됐을 수 있어요. 이 페이지를 새로고침하세요 (미저장 편집은 유실되지만, 이후 편집은 다시 저장됩니다).",
    rowGif: "GIF", tRowGif: "이 줄의 현재 합성 시퀀스를 GIF 로 다운로드 — 선명하게 보이도록 4배 니어리스트로 굽는다 (픽셀 데이터는 그대로)",
    tRowDl: "이 줄의 현재 합성 시퀀스 다운로드 — GIF(서버 굽기, 4배) / WebM(투명) / MP4(흰 배경)",
    rowDlDone: (s, f) => `${s}.${f} 다운로드 완료`,
    tHandTool: "손 — 드래그로 화면 이동. Space 를 누르고 있는 동안은 어디서든 임시 손 (떼면 원래 툴로)",
    rowReroll: "리롤", tRowReroll: "이 줄을 한 번 더 생성해서 **후보군에 병기** (rerollN 테이크) — 기존 프레임은 그대로, 새 롤 프레임이 라벨 달고 옆에 온다. 클릭 = 모델 팝오버(보간과 같은 관용구), 생성 = 전체 배치 재추출 후 뷰 새로고침.",
    rerollBusy: (s) => `${s}: 리롤 생성 중… (생성 + 전체 재추출, 수 분)`,
    rerollDone: (s) => `${s}: 리롤 후보 추가 완료 — 새로고침`,
    rerollFail: "리롤 실패: ",
    tRenameHint: "배지를 더블클릭하면 이름을 붙일 수 있어요",
    renamePrompt: "인스턴스 이름 (비우면 제거):",
    cmpOpen: "비교", tCmpOpen: "방향 앵커(idle)들을 한 캔버스에서 비교 — 나란히/겹침, 공유 바닥선, 클릭으로 드래그 가이드 추가",
    tCmpPlay: "모든 스프라이트 재생/정지 (각자 시퀀스·fps·호흡 레이어 포함)", atlasBake: "지금 상태로 굽기", tAtlasBake: "현재 큐레이션 상태(시퀀스·변형·픽셀편집·호흡) 그대로 아틀라스를 다시 구워 이 섹션을 갱신합니다 — 다운로드 없음",
    atlasBaking: "굽는 중…", atlasBaked: "현재 큐레이션 상태로 아틀라스를 다시 구웠습니다",
    atlasStale: "편집 반영 안 됨", atlasBakeFail: "굽기 실패: ",
    tCmpGif: "비교 캔버스를 루프 GIF 로 다운로드 (현재 배치+재생 그대로, 가상 시간 결정론 샘플)",
    cmpGifDone: "비교 GIF 다운로드 완료", cmpGifFail: "비교 내보내기 실패: ",
    cmpDl: "저장", tCmpDl: "비교 캔버스를 애니메이션으로 다운로드 — 팝오버에서 GIF / WebM(투명) / MP4(흰 배경) 선택 (현재 배치+재생 그대로, 가상 시간 결정론 샘플)",
    cmpDlAlpha: "투명", cmpDlWhite: "흰 배경", cmpDlDone: (f) => `비교 ${f} 다운로드 완료`,
    cmpMarks: "기준선", tCmpMarks: "첫 번째 켜진 스프라이트의 팔레트 신호로 신체 기준선(정수리·턱선·망토 시작·벨트·치맛단·발끝)을 자동 감지해 가로 가이드로 추가",
    cmpMarksDone: (n) => `기준선 가이드 ${n}개 추가`, cmpMarksNone: "기준선을 감지할 스프라이트가 없습니다",
    cmpGuidesHide: "선 감추기", cmpGuidesShow: "선 보이기", cmpGuidesClear: "선 전부 지우기",
    tCmpGuidesToggle: "가이드선 전체 보이기/감추기 (지워지지 않고 잠깐 숨김)",
    tCmpGuidesClear: "가이드선 전부 삭제 (Cmd/Ctrl+Z 로 되돌리기 가능)",
    cmpTitle: "비교", cmpH: "수평", cmpV: "수직", cmpOverlay: "겹침",
    cmpHint: "좌측 목록으로 스프라이트 켜고 끄기 · 스프라이트는 잡고 드래그 · 빈 곳 클릭 = 가로선, Shift+클릭 = 세로선 · 선 클릭 = 포커스, 드래그 = 이동, Delete = 삭제 · 휠 = 배율 · Cmd/Ctrl+Z 되돌리기 · 정렬 버튼 = 배치 리셋",
    cmpNone: "비교할 추출된 idle 앵커가 없습니다",
    seqCount: (play, src) => `재생 ${play}컷 · 원본 ${src}장`,
    tRelink: "독립 복제 (자기 편집 보유) — 클릭하면 원본과 다시 링크합니다: 이 복제의 자체 편집은 버려지고 원본을 따라갑니다",
    relinked: (s) => `${s} 와 재링크 — 다시 원본 편집을 따라갑니다`,
    tUnlink: "링크된 복제 — 편집이 원본과 동기화됩니다. 클릭하면 링크를 끊고 독립 프레임이 됩니다 (현재 편집을 복사, 이후 편집은 각자)",
    unlinked: (s) => `${s} 와 링크 해제 — 독립 프레임이 됐습니다`,
    tFpsStepper: "줄 전체 재생 속도 (state fps — sprite-request 에 저장). 특정 프레임을 길게 보여주려면 프레임 복제를 쓰세요 (복제는 아틀라스 셀 공유 = 부하 0)",
    fpsSet: (s, f) => `${s}: ${f}fps`, fpsFail: "fps 변경 실패: ",
    rowBreathe: "호흡", tRowBreathe: "호흡은 프레임 선택과 직교하는 후처리 레이어입니다 — 깜빡임 프레임도 그대로 숨쉽니다. 체크: 켜기 (즉시, 사이드카 저장 — 아틀라스/GIF 굽기에 결정론 반영), 해제: 끄기. 라벨 클릭: 실제 재생 위에서 강체 경계, 가로와 세로 범위, 호흡 횟수 조정.",
    tRowBreatheEdit: "호흡 편집기 열기 — 조정은 재생 중인 시퀀스에 즉시 반영됩니다. Esc = 이전 설정 복원",
    breatheWidth: "가로", breatheHeight: "세로", breatheMin: "최소: 이 축에서 숨이 가장 작을 때",
    breatheMax: "최대: 이 축에서 숨이 가장 클 때",
    tBreatheWidth: "숨이 가장 큰 줄에서 몸통이 넓어지는 비율, 원본 대비 (0 = 원래 폭, -20~20%). pixel 은 가장 넓을 때 머리가 가장 낮다",
    tBreatheHeight: "목 아래 몸 높이 대비 머리 끝(smooth 는 가슴)이 올라가는 비율 (음수 = 내려감, 0 = 원래 높이, -20~20%)",
    breatheCountLabel: "호흡/루프", breatheFitted: (n) => n === 0 ? "→ 숨쉴 자리 없음" : `→ 적용 ${n}회`,
    breatheAuto: "자동", tBreatheAuto: "수동 경계를 버리고 검출값을 쓴다 (목 병목, 얼굴이 몸통에 있으면 얼굴 아래)",
    tBreatheFitted: (len) => `루프가 ${len}프레임 — 더 부드럽게 하려면 시퀀스에 프레임을 늘리세요`, tBreatheCount: "루프당 호흡 횟수 (1~8) — 위상이 연속값이라 요청한 횟수가 그대로 적용됩니다",
    
        breatheHint: "강체 경계를 드래그 — 이 위는 도트 단위로 그대로 남고, 아래 몸통이 눌렸다 펴지며 머리가 반 박자 늦게 따라옵니다. 즉시 반영, Cmd/Ctrl+Z 이전/다음, Esc 복원.",
    breatheRecalc: "재계산 중\u2026",
    breatheAxisHint: "몸통 축을 드래그 — 숨쉴 때 절대 움직이지 않는 세로 중심 열입니다. 몸통 폭 선이 이 축을 기준으로 대칭 이동합니다.",
    breatheTorsoHint: "몸통 반폭을 드래그 — 이 선 바깥은 부속(팔·날개)으로 취급되어 늘어나지 않고 밀리기만 합니다. 안쪽으로 끌수록 보호가 넓어집니다.",
    breatheFail: "호흡 실패: ",
    breatheResample: (rows) =>
      `참고: ${rows} 에 회전/확대 변형이 걸려 있다. 굽기는 부드럽게, 이 캔버스는 NEAREST 로 `
      + `리샘플하므로 내보낸 파일이 GIF 와 가장자리 몇 px 다르다.`,
    opProgress: (p, pct) => `재추출 ${p.done}/${p.total} (${pct}%) — ${p.label} · ${p.phase === "components" ? "컴포넌트" : "픽셀 언페이크"}`,
    healTitle: "엔진 갱신 반영 중 — 프레임 재계산",
    healNote: "죄송해요~ 조금만 기다려 주세요! 엔진 갱신 반영은 이번 한 번이면 돼요. 끝나면 바로 열어 드릴게요!",
    healWaiting: "준비하고 있어요~",
    breatheStrip: (n, actual) => `최종 굽기: 루프 ${n}프레임 그대로 · 호흡 ${actual}회`,
    breatheStripOff: (n) => `최종 굽기: 루프 ${n}프레임 · 호흡 꺼짐`,
    breatheOn: (s) => `${s}: 호흡 레이어 켜짐`,
    breatheOff: (s) => `${s}: 호흡 레이어 꺼짐`,
    rowTween: "보간", tRowTween: "AI 중간 프레임: 이 줄의 두 프레임 사이를 생성형(codex/grok — 서버 머신의 CLI 인증 사용)으로 그려 테이크로 기록 — 이후 전체 배치 재추출. 카드를 클릭해 쌍을 고르세요.",
    tweenFrom: "시작", tweenTo: "끝", tweenT: "t", genGo: "생성",
    tweenBusy: "보간 + 전체 배치 재추출 중… (1~2분)",
    tweenDone: (s) => `${s}: 중간 프레임 추가됨 — 새로고침합니다`,
    tweenFail: "보간 실패: ",
    treeAtlas: "최종 아틀라스", atlasDoc: "manifest.json (런타임 문서)",
    atlasPending: "아직 합성 전 — 아틀라스 다운로드를 누르면 계산돼 생성됩니다",
    atlasStamp: (d) => `${d} 계산본`, tTreeAtlas: "최종 아틀라스 섹션으로 스크롤",
    rcTitle: "컬러웨이", treeRecolor: "variants/", treeRecolorNote: "구운 컬러웨이",
    tTreeRecolor: "컬러웨이 섹션으로 스크롤",
    rcBase: "베이스 (치환 없음)", rcPick: "채택", rcPicked: "✓ 채택됨", rcMissing: "시트 없음",
    rcMeta: (n, match, tol) => `variant ${n}개 · ${match}${match === "tolerance" ? ` ±${tol}` : ""} 매칭 · variants/`,
    rcVariantNote: (sub, pass) => `치환 ${sub}px · 통과 ${pass}px`,
    rcUnusedSources: (list) => `아무것도 못 맞춘 소스 색: ${list.join(", ")}`,
    rcPickUnknown: (name) => `채택된 컬러웨이 "${name}" 가 지금 베이크에 없습니다 — 다시 굽거나 다른 것을 채택하세요 (채택 기록은 지우지 않고 그대로 둡니다)`,
    rcPickSaved: (name) => `컬러웨이 채택: ${name}`, rcPickCleared: "컬러웨이 채택 해제",
    tRcSection: "`sprite-gen recolor` 가 <run-dir>/variants 에 구운 색 변형 시트 — 런타임이 읽는 파일 그 자체라, 여기서 비교하는 것이 곧 출시본입니다",
    tRcThumb: "올려놓기만 하면 큰 화면이 같은 자리에서 이 시트로 갈아끼워집니다 (한 칸짜리 색차는 같은 자리 교체로만 보입니다) — 클릭하면 고정",
    tRcPick: "이 컬러웨이를 채택으로 curation.json 에 기록합니다 (다시 누르면 해제). 디스크의 시트는 건드리지 않습니다",
    rowGifDone: (s) => `${s}.gif 다운로드 완료`,
    baking: "계산 중…", composeDone: "아틀라스 다운로드 완료", composeFail: "다운로드 실패: ",
    exporting: "계산 중…", exportFail: "다운로드 실패: ",
    ready: "준비됨", loaded: "기존 큐레이션 로드됨", runLoadFail: "run 로드 실패:",
    tRotate: "회전", tShear: "기울이기 — 가로=shx, 세로=shy", tReset: "보정 초기화", tFlipX: "좌우 반전 — 토글이 아니라 도구: 누를 때마다 반전. 마키 선택이 있으면 그 영역 픽셀만(누를 때마다 Cmd/Ctrl+Z 되돌림 가능), 없으면 프레임 전체",
    tReorder: "타이틀을 잡고 드래그 = 순서변경 / 시퀀스↔풀 이동. 드래그 없이 넣고 뺄 땐 넣기·빼기 버튼",
    tPlay: "재생", tPause: "일시정지", tPrev: "이전 프레임", tNext: "다음 프레임", tSpeed: "재생 속도",
    zoneSeq: "달리기 시퀀스", zonePool: "후보 풀 — 마음에 드는 컷을 위로 끌어 추가", addToSeq: "넣기", removeFromSeq: "빼기",
    tSelAdd: "시퀀스에 넣기 (위로 이동)", tSelRemove: "후보 풀로 빼기 (아래로 이동)",
    tTitleCopy: "풀네임 — 드래그해서 복사 (제목 자체를 잡으면 순서변경)",
    cellPx: "셀", tContentPx: "실제 스프라이트 픽셀 (투명 여백 제외)",
    tZoomOpen: "크게 보기 (이미지 더블클릭도 됨)",
    tZoomStage: "휠/핀치 = 화면 확대 · Space/휠버튼 드래그 = 화면 이동 · 드래그 = 스프라이트 이동 · 모서리 크기 조절 = 스프라이트 크기",
    tViewZoomIn: "화면 확대 (돋보기 — 보기 배율만 커지고 스프라이트 자체는 그대로)",
    tViewZoomOut: "화면 축소",
    tViewZoomFit: "화면에 맞춤 + 중앙 정렬",
    zoomClose: "✕", tZoomPrev: "이전 프레임", tZoomNext: "다음 프레임",
    dirAnchorBadge: "방향 앵커",
    tDirAnchorBadge: "이 방향의 canonical 앵커 — base 에서 생성되고, 이 방향의 다른 모든 행이 여기서 identity 를 가져온다",
    anchorFrameBadge: "앵커",
    anchorFrameStaleBadge: "앵커?",
    tAnchorFrameStale: "이 핀이 네가 승인한 그 프레임을 가리킨다고 더 이상 증명되지 않는다 (그 행이 재생성됐거나 세대 스탬프가 없다). 재지정할 때까지 생성은 fail-loud 다 — 원하는 프레임의 핀 버튼을 눌러라",
    tRepinAnchorFrame: "이 프레임으로 앵커 재지정 (낡은 핀을 풀고 현재 세대로 도장한다)",
    tAnchorFrameBadge: "이 프레임이 — 큐레이션(픽셀 편집·변형) 그대로 — 이 방향의 다른 행을 생성할 때 붙는 identity 다. 시퀀스 첫 프레임을 따라가므로 재정렬·삭제하면 옮겨간다 — 고정하려면 핀을 눌러라",
    tAnchorFramePinned: "이 방향의 앵커로 고정됨 — 다른 프레임을 재정렬·삭제해도 이 프레임이 앵커로 남는다",
    tSetAnchorFrame: "이 프레임을 방향 앵커로 고정 — 이 방향의 다른 자세들을 바로 이 후처리된 프레임에서 생성하고, 시퀀스 첫 프레임을 따라가지 않는다",
    tUnsetAnchorFrame: "앵커 지정 해제 (앵커 행의 시퀀스 첫 프레임으로 되돌림)",
    anchorPinned: (d, label) => `${d} 방향 앵커 = ${label}`,
    anchorUnpinned: (d, label) => `${d} 방향 앵커를 기본값으로 (${label})`,
    anchorError: (d, msg) => `${d} 방향 앵커 해석 실패: ${msg}`,
    dirGroupLabel: (d) => `방향 · ${d}`,
    dirMirrorLabel: (d, src) => `방향 · ${d} — ${src} 런타임 미러 (생성 없음)`,
    treeTitle: "생성 구조",
    treePipeline: "파이프라인",
    treeFiles: "파일",
    treeBaseNote: "base — 최초 identity",
    treeIdleRow: "idle 행",
    treeAnchorNote: "앵커 · frame-0 크롭 1장",
    treeMirror: (d, src) => `${d} — ${src} 런타임 미러 (생성 없음)`,
    treePending: "미생성",
    treeRawNote: "raw 생성됨 · 추출 전",
    missingPending: "미생성",
    archiveChip: (n) => `보관함 ${n}`,
    tArchiveChip: "클릭 = 열기 · 카드를 여기로 끌어오면 보관",
    tArchiveBtn: "보관함으로 (후보 풀에서도 제외)",
    tScaleScrub: "스프라이트 크기 — 화살표 클릭 = 단계 조절, 크기 아이콘 좌우 드래그 = 연속 조절 (화면 배율은 돋보기 위젯)",
    penTool: "연필", eraserTool: "지우개", pickTool: "스포이드", undoEdit: "되돌리기", redoEdit: "재실행", clearEdits: "편집 비우기",
    selectTool: "선택", tSelectTool: "영역 선택: 드래그로 점선 박스를 만들고 — 안쪽을 드래그하면 이동, Alt+드래그는 복제, Esc 는 선택 해제",
    transformTool: "변형", lassoTool: "올가미",
    tLassoTool: "올가미: 자유곡선으로 감싸 네모가 아닌 영역을 잡는다. 놓으면 변형 툴로 넘어간다. Esc 는 선택 해제",
    lassoSelected: (n) => `올가미: ${n}px 선택 — 드래그 이동, Shift 회전, Alt 비틀기`,
    tTransformTool: "변형 (기본): 드래그 = 이동, Shift+드래그 = 회전, Alt+드래그 = 비틀기. 마퀴 선택이 있으면 **그 영역만** 변형해 픽셀로 굽고, 선택이 없으면 셀 전체를 변형한다",
    regionTransformed: "영역을 변형했다 (픽셀 편집으로 구움 — Cmd/Ctrl+Z 로 되돌리기)",
    tUndoKeys: "되돌리기 (Cmd/Ctrl+Z)", tRedoKeys: "재실행 (Cmd/Ctrl+Shift+Z)",
    baseEditBtn: "편집", tBaseEdit: "베이스 이미지 자체를 픽셀 편집 — base-source 파일에 저장 (원본은 .orig 로 1회 백업). 이미 뽑힌 프레임은 안 변하고 이후 생성에 반영됩니다",
    baseEditSave: "베이스에 저장", baseEditFail: "베이스 저장 실패: ",
    baseUnsaved: "베이스 편집 중 — '베이스에 저장' 을 눌러야 파일에 반영됩니다",
    baseEditSaved: (n) => `베이스 갱신됨 (${n}px) — 이후 생성에 반영`,
    tPick: "스포이드 — 픽셀을 클릭하면 그 색을 집어 연필로 전환, 똑같은 색으로 바로 찍을 수 있어",
    archiveHint: "카드를 끌어내 시퀀스/후보로 복구",
    archModalTitle: (st, n) => `보관함 · ${st} (${n})`,
    restoreToSeq: "시퀀스로", restoreToPool: "후보로",
    missingRawWait: "생성됨 · 추출 대기",
    treeRawFolder: "생성 스트립 원본",
    treeFramesFolder: "추출 프레임",
    treeAnchorsFolder: "방향 앵커 — 1장 크롭",
    treeAtlasNote: "최종 아틀라스",
    treeFrameCount: (n) => `${n}프레임`,
    treeAnchorOrigin: (d) => `idle 행 · ${d} 앵커 원천`,
    reloadBanner: "런이 갱신됐어 — 클릭해서 새로고침",
    tDupBtn: "이 프레임 복제 — 자기 변형을 따로 갖는 새 카드 (같은 원본 이미지를 굽는다)",
    cloneBadge: (name) => `${name} 복제`,
    tCloneBadge: "복제 인스턴스 — 원본 프레임 이미지를 읽고, 변형/픽셀편집은 이 카드 것. 보관 버튼은 복제를 완전히 제거한다.",
    curationDropped: (states) =>
      `프레임이 재생성돼 ${states.join(", ")} 의 이전 큐레이션이 더 이상 맞지 않아 초기화됐어. ` +
      `디스크의 curation.json 은 그대로고, 다음 저장 때 curation.stale-<hash>.json 으로 백업돼.`,
    tTreeNode: "클릭하면 해당 줄로 이동",
    hints: ["타이틀 드래그 = 순서변경 / 시퀀스↔풀 이동", "넣기·빼기 버튼으로 토글 (클릭만으론 안 빠짐)", "제목 호버 = 풀네임 복사", "우하단 돋보기 = 크기 · 상단 핸들 = 회전", "복제 = 헤더 ⧉ 버튼", "자동 저장"],
    exportDone: () => "PNG 다운로드 완료",
    exportGifDone: () => "GIF 다운로드 완료",
  },
};

let lang = "en";

function t(key) {
  const v = (STR[lang] && STR[lang][key]) ?? STR.en[key];
  return v;
}

function applyStaticLang() {
  document.getElementById("t-title").textContent = t("title");
  document.getElementById("dl-main").textContent = `${t("cmpDl")} ▾`;
  document.getElementById("compose").textContent = t("compose");
  document.getElementById("export").textContent = t("export");
  document.getElementById("export-gif").textContent = t("exportGif");
  gridToggle.textContent = `${t("groundGrid")} ${document.body.classList.contains("show-grid") ? "▣" : "▢"}`;
  langToggle.textContent = t("langOther");
  const ppLabel = document.getElementById("pp-label");
  if (ppLabel) ppLabel.textContent = t("unfakeApply");
  const pxLabel = document.getElementById("pxgrid-label");
  if (pxLabel) pxLabel.textContent = t("pxGridAll") + (run.pixelUnfake && run.pixelUnfake.label ? " \u00b7 " + run.pixelUnfake.label : "");
  const pxWrap = document.getElementById("pxgrid-wrap");
  if (pxWrap) pxWrap.title = t("tPxGrid");
  const unfakeWrap = document.getElementById("unfake-wrap");
  if (unfakeWrap) unfakeWrap.title = t("tUnfakeApply");
  document.getElementById("hintbar").innerHTML = t("hints").map((h) => `<span>${h}</span>`).join("");
}

// 실시간 계약 (maintainer 확정 2026-07-14): 버튼은 '게임에 적용'이 아니다 — 지금
// 보이는 라이브 상태(프레임 캐시 + 큐레이션)를 서버가 그 자리에서 계산해
// 파일(zip)로 내려주는 다운로드다. 서버는 계산 전에 캐시를 자가치유한다.