refactor(popup): 5종 팝업 _i18n 주입 + 색상 토큰화 (WS-POPUP)
- 4종 팝업(command/history/result/recording-tip) _i18n 주입: WindowManager getPopupI18nStrings() + 팝업 script applyI18nToHtml() - 한국어/영어 하드코딩 -> popup.* i18n 키 (ko/en 17키) - theme-vars.ts에 --d3-wave-1~9, --d3-status-error/success 토큰 추가 (6 테마) - 팝업 style.css hex -> CSS var 토큰 - packages/i18n getI18n() (main 프로세스용) 추가 SKIP: caption-overlay _i18n(별도 IPC 구조), wave box-shadow 보간(opacity 단순화) 정책: docs/REFACTOR_POLICY.md DP3, 이식 인사이트 P5
This commit is contained in:
parent
660e622a93
commit
00a99e4087
15 changed files with 256 additions and 35 deletions
|
|
@ -226,3 +226,21 @@ export function useI18n(): I18nContextValue {
|
|||
export function isValidLocale(value: string): value is Locale {
|
||||
return value in LOCALE_MAP
|
||||
}
|
||||
|
||||
// ── Main 프로세스용 i18n (React 없음) ───────────────────
|
||||
/**
|
||||
* Electron main 프로세스에서 사용하는 간단한 i18n 함수.
|
||||
* React Context 없이 로케일 문자열로 직접 번역 map을 반환.
|
||||
* @param locale 로케일 코드 (기본값 'ko')
|
||||
* @returns 번역 함수 map (t: (key) => translated string)
|
||||
*/
|
||||
export function getI18n(locale: Locale = 'ko'): {
|
||||
t: (key: TranslationKey, params?: Record<string, string | number>) => string
|
||||
locale: Locale
|
||||
} {
|
||||
const translations = LOCALE_MAP[locale] ?? ko
|
||||
const t = (key: TranslationKey, params?: Record<string, string | number>): string => {
|
||||
return resolveTranslation(key, translations, params)
|
||||
}
|
||||
return { t, locale }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -553,5 +553,23 @@
|
|||
"onboarding.sttModelSize": "Size: ~1.6GB — takes 2–10 min depending on network speed",
|
||||
"onboarding.step": "Step {{current}}/{{total}}",
|
||||
"onboarding.progressDetail": "{{downloaded}} / {{total}} MB",
|
||||
"onboarding.ollamaNotRunning": "Ollama server is not running. Please retry shortly."
|
||||
"onboarding.ollamaNotRunning": "Ollama server is not running. Please retry shortly.",
|
||||
|
||||
"popup.commandSelect": "COMMAND SELECT",
|
||||
"popup.hints.select": "↑↓ Select",
|
||||
"popup.hints.apply": "⏎ Apply",
|
||||
"popup.hints.clear": "0 Clear",
|
||||
"popup.hints.close": "ESC ×",
|
||||
"popup.noCommands": "No commands",
|
||||
"popup.noCommand": "No command (insert original)",
|
||||
"popup.hints.selectEn": "↑↓ Select",
|
||||
"popup.hints.paste": "⏎ Paste",
|
||||
"popup.noHistory": "No history yet",
|
||||
"popup.time.justNow": "just now",
|
||||
"popup.time.minutesAgo": "{{m}}m ago",
|
||||
"popup.time.hoursAgo": "{{h}}h ago",
|
||||
"popup.time.daysAgo": "{{d}}d ago",
|
||||
"popup.copy": "Copy",
|
||||
"popup.error.default": "An error occurred",
|
||||
"popup.caption.loading": "⏳ Loading STT model..."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -553,5 +553,23 @@
|
|||
"onboarding.sttModelSize": "크기: 약 1.6GB — 네트워크 속도에 따라 2~10분 소요",
|
||||
"onboarding.step": "단계 {{current}}/{{total}}",
|
||||
"onboarding.progressDetail": "{{downloaded}} / {{total}} MB",
|
||||
"onboarding.ollamaNotRunning": "Ollama 서버가 실행되지 않았습니다. 잠시 후 다시 시도하세요."
|
||||
"onboarding.ollamaNotRunning": "Ollama 서버가 실행되지 않았습니다. 잠시 후 다시 시도하세요.",
|
||||
|
||||
"popup.commandSelect": "명령어 선택",
|
||||
"popup.hints.select": "↑↓ 선택",
|
||||
"popup.hints.apply": "⏎ 적용",
|
||||
"popup.hints.clear": "0 해제",
|
||||
"popup.hints.close": "ESC ×",
|
||||
"popup.noCommands": "명령어 없음",
|
||||
"popup.noCommand": "없음 (원본 삽입)",
|
||||
"popup.hints.selectEn": "↑↓ Select",
|
||||
"popup.hints.paste": "⏎ Paste",
|
||||
"popup.noHistory": "히스토리 없음",
|
||||
"popup.time.justNow": "방금",
|
||||
"popup.time.minutesAgo": "{{m}}분 전",
|
||||
"popup.time.hoursAgo": "{{h}}시간 전",
|
||||
"popup.time.daysAgo": "{{d}}일 전",
|
||||
"popup.copy": "복사",
|
||||
"popup.error.default": "오류가 발생했습니다",
|
||||
"popup.caption.loading": "⏳ STT 모델 로딩 중..."
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue