diff --git a/packages/ui/src/lib/i18n/bootstrap.ts b/packages/ui/src/lib/i18n/bootstrap.ts index 1c6ac1bb..dc712f63 100644 --- a/packages/ui/src/lib/i18n/bootstrap.ts +++ b/packages/ui/src/lib/i18n/bootstrap.ts @@ -57,6 +57,139 @@ const FR_MESSAGES: BootstrapMessages = { loadingData: (providersText, agentsText) => `Chargement des données (${providersText}, ${agentsText})…`, }; +const ZH_CN_MESSAGES: BootstrapMessages = { + startingApi: '正在启动 OpenCode API…', + initializing: '正在初始化…', + connecting: '正在连接…', + connected: '已连接!', + connectionError: '连接错误', + disconnected: '已断开连接', + reconnecting: '正在重新连接…', + initialDataLoadFailed: 'OpenCode 已连接,但初始数据加载失败。', + cliNotFound: '未找到 OpenCode CLI。请先安装它。', + providersReady: '✓ 提供商', + providersLoading: '… 提供商', + agentsReady: '✓ 智能体', + agentsLoading: '… 智能体', + startingDevServer: (hostLabel) => `正在启动 webview 开发服务器 (${hostLabel})...`, + waitingDevServer: (hostLabel, attempt) => `正在等待 webview 开发服务器 (${hostLabel})... 第 ${attempt} 次尝试`, + loadingData: (providersText, agentsText) => `正在加载数据 (${providersText}, ${agentsText})…`, +}; + +const ZH_TW_MESSAGES: BootstrapMessages = { + startingApi: '正在啟動 OpenCode API…', + initializing: '正在初始化…', + connecting: '正在連線…', + connected: '已連線!', + connectionError: '連線錯誤', + disconnected: '已中斷連線', + reconnecting: '正在重新連線…', + initialDataLoadFailed: 'OpenCode 已連線,但初始資料載入失敗。', + cliNotFound: '找不到 OpenCode CLI。請先安裝。', + providersReady: '✓ 提供者', + providersLoading: '… 提供者', + agentsReady: '✓ 代理', + agentsLoading: '… 代理', + startingDevServer: (hostLabel) => `正在啟動 webview 開發伺服器 (${hostLabel})...`, + waitingDevServer: (hostLabel, attempt) => `正在等待 webview 開發伺服器 (${hostLabel})... 第 ${attempt} 次嘗試`, + loadingData: (providersText, agentsText) => `正在載入資料 (${providersText}, ${agentsText})…`, +}; + +const UK_MESSAGES: BootstrapMessages = { + startingApi: 'Запуск OpenCode API…', + initializing: 'Ініціалізація…', + connecting: 'Підключення…', + connected: 'Підключено!', + connectionError: 'Помилка підключення', + disconnected: 'Відключено', + reconnecting: 'Повторне підключення…', + initialDataLoadFailed: 'OpenCode підключено, але початкове завантаження даних не вдалося.', + cliNotFound: 'OpenCode CLI не знайдено. Спершу встановіть його.', + providersReady: '✓ Провайдери', + providersLoading: '… Провайдери', + agentsReady: '✓ Агенти', + agentsLoading: '… Агенти', + startingDevServer: (hostLabel) => `Запуск dev-сервера webview (${hostLabel})...`, + waitingDevServer: (hostLabel, attempt) => `Очікування dev-сервера webview (${hostLabel})... спроба ${attempt}`, + loadingData: (providersText, agentsText) => `Завантаження даних (${providersText}, ${agentsText})…`, +}; + +const ES_MESSAGES: BootstrapMessages = { + startingApi: 'Iniciando la API de OpenCode…', + initializing: 'Inicializando…', + connecting: 'Conectando…', + connected: '¡Conectado!', + connectionError: 'Error de conexión', + disconnected: 'Desconectado', + reconnecting: 'Reconectando…', + initialDataLoadFailed: 'OpenCode se conectó, pero falló la carga inicial de datos.', + cliNotFound: 'No se encontró OpenCode CLI. Instálalo primero.', + providersReady: '✓ Proveedores', + providersLoading: '… Proveedores', + agentsReady: '✓ Agentes', + agentsLoading: '… Agentes', + startingDevServer: (hostLabel) => `Iniciando el servidor de desarrollo de webview (${hostLabel})...`, + waitingDevServer: (hostLabel, attempt) => `Esperando el servidor de desarrollo de webview (${hostLabel})... intento ${attempt}`, + loadingData: (providersText, agentsText) => `Cargando datos (${providersText}, ${agentsText})…`, +}; + +const PT_BR_MESSAGES: BootstrapMessages = { + startingApi: 'Iniciando a API do OpenCode…', + initializing: 'Inicializando…', + connecting: 'Conectando…', + connected: 'Conectado!', + connectionError: 'Erro de conexão', + disconnected: 'Desconectado', + reconnecting: 'Reconectando…', + initialDataLoadFailed: 'OpenCode conectado, mas o carregamento inicial dos dados falhou.', + cliNotFound: 'OpenCode CLI não encontrado. Instale-o primeiro.', + providersReady: '✓ Provedores', + providersLoading: '… Provedores', + agentsReady: '✓ Agentes', + agentsLoading: '… Agentes', + startingDevServer: (hostLabel) => `Iniciando o servidor de desenvolvimento da webview (${hostLabel})...`, + waitingDevServer: (hostLabel, attempt) => `Aguardando o servidor de desenvolvimento da webview (${hostLabel})... tentativa ${attempt}`, + loadingData: (providersText, agentsText) => `Carregando dados (${providersText}, ${agentsText})…`, +}; + +const KO_MESSAGES: BootstrapMessages = { + startingApi: 'OpenCode API 시작 중…', + initializing: '초기화 중…', + connecting: '연결 중…', + connected: '연결됨!', + connectionError: '연결 오류', + disconnected: '연결 끊김', + reconnecting: '다시 연결 중…', + initialDataLoadFailed: 'OpenCode에 연결되었지만 초기 데이터 로드에 실패했습니다.', + cliNotFound: 'OpenCode CLI를 찾을 수 없습니다. 먼저 설치하세요.', + providersReady: '✓ 공급자', + providersLoading: '… 공급자', + agentsReady: '✓ 에이전트', + agentsLoading: '… 에이전트', + startingDevServer: (hostLabel) => `webview 개발 서버 시작 중 (${hostLabel})...`, + waitingDevServer: (hostLabel, attempt) => `webview 개발 서버 대기 중 (${hostLabel})... ${attempt}번째 시도`, + loadingData: (providersText, agentsText) => `데이터 로드 중 (${providersText}, ${agentsText})…`, +}; + +const PL_MESSAGES: BootstrapMessages = { + startingApi: 'Uruchamianie API OpenCode…', + initializing: 'Inicjalizacja…', + connecting: 'Łączenie…', + connected: 'Połączono!', + connectionError: 'Błąd połączenia', + disconnected: 'Rozłączono', + reconnecting: 'Ponowne łączenie…', + initialDataLoadFailed: 'OpenCode połączony, ale początkowe ładowanie danych nie powiodło się.', + cliNotFound: 'Nie znaleziono OpenCode CLI. Najpierw go zainstaluj.', + providersReady: '✓ Dostawcy', + providersLoading: '… Dostawcy', + agentsReady: '✓ Agenci', + agentsLoading: '… Agenci', + startingDevServer: (hostLabel) => `Uruchamianie serwera deweloperskiego webview (${hostLabel})...`, + waitingDevServer: (hostLabel, attempt) => `Oczekiwanie na serwer deweloperski webview (${hostLabel})... próba ${attempt}`, + loadingData: (providersText, agentsText) => `Ładowanie danych (${providersText}, ${agentsText})…`, +}; + const JA_MESSAGES: BootstrapMessages = { startingApi: 'OpenCode API を起動中…', initializing: '初期化中…', @@ -77,9 +210,20 @@ const JA_MESSAGES: BootstrapMessages = { }; export const getBootstrapMessages = (locale: Locale): BootstrapMessages => { - if (locale === 'fr') return FR_MESSAGES; - if (locale === 'ja') return JA_MESSAGES; - return EN_MESSAGES; + return BOOTSTRAP_MESSAGES[locale]; +}; + +const BOOTSTRAP_MESSAGES: Record = { + en: EN_MESSAGES, + fr: FR_MESSAGES, + 'zh-CN': ZH_CN_MESSAGES, + 'zh-TW': ZH_TW_MESSAGES, + uk: UK_MESSAGES, + es: ES_MESSAGES, + 'pt-BR': PT_BR_MESSAGES, + ko: KO_MESSAGES, + pl: PL_MESSAGES, + ja: JA_MESSAGES, }; export const readStoredLocaleForBootstrap = (): Locale => {