|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +import assert from 'node:assert/strict'; |
| 21 | +import { test } from 'node:test'; |
| 22 | +import { getArtifactCopy } from '../../renderer/locales/artifact-copy.js'; |
| 23 | +import { getBrowserCopy } from '../../renderer/locales/browser-copy.js'; |
| 24 | +import { getDesktopConversationCopy } from '../../renderer/locales/conversation-copy.js'; |
| 25 | +import { getExternalSessionImportCopy } from '../../renderer/locales/external-session-import-copy.js'; |
| 26 | +import { getMcpCopy } from '../../renderer/locales/mcp-copy.js'; |
| 27 | +import { getPlanModeCopy } from '../../renderer/locales/plan-mode-copy.js'; |
| 28 | +import { getBotSettingsCopy } from '../../renderer/locales/settings-bot-copy.js'; |
| 29 | +import { getDailyReviewSettingsCopy } from '../../renderer/locales/settings-daily-review-copy.js'; |
| 30 | +import { getDataSettingsCopy } from '../../renderer/locales/settings-data-copy.js'; |
| 31 | +import { getHealthCenterCopy } from '../../renderer/locales/settings-health-copy.js'; |
| 32 | +import type { HealthSignal } from '@maka/core/health'; |
| 33 | +import { getMemorySettingsCopy } from '../../renderer/locales/settings-memory-copy.js'; |
| 34 | +import { getSettingsNavigationCopy } from '../../renderer/locales/settings-navigation-copy.js'; |
| 35 | +import { getSettingsProjectsCopy } from '../../renderer/locales/settings-projects-copy.js'; |
| 36 | +import { getProviderSettingsCopy } from '../../renderer/features/connection-settings/index.js'; |
| 37 | +import { getSettingsSharedCopy } from '../../renderer/locales/settings-shared-copy.js'; |
| 38 | +import { getSubagentSettingsCopy } from '../../renderer/locales/settings-subagents-copy.js'; |
| 39 | +import { getSettingsTasksCopy } from '../../renderer/locales/settings-tasks-copy.js'; |
| 40 | +import { settingsTestResultMessage } from '../../renderer/locales/settings-test-result-copy.js'; |
| 41 | +import type { SettingsTestResult } from '@maka/core/settings'; |
| 42 | +import { getUsageSettingsCopy } from '../../renderer/locales/settings-usage-copy.js'; |
| 43 | +import { getWebSearchSettingsCopy } from '../../renderer/locales/settings-web-search-copy.js'; |
| 44 | +import { getSettingsPreferencesCopy } from '../../renderer/locales/settings-preferences-copy.js'; |
| 45 | + |
| 46 | +function collectStrings(value: unknown): string[] { |
| 47 | + if (typeof value === 'string') return [value]; |
| 48 | + if (typeof value === 'function' || value === null || typeof value !== 'object') return []; |
| 49 | + return Object.values(value).flatMap(collectStrings); |
| 50 | +} |
| 51 | + |
| 52 | +test('all Desktop slice-2 catalogs expose visibly Korean copy', () => { |
| 53 | + const values = [ |
| 54 | + getArtifactCopy('ko').pane.copy, |
| 55 | + getBrowserCopy('ko').title, |
| 56 | + getDesktopConversationCopy('ko').actions.conversationErrorTitle, |
| 57 | + getExternalSessionImportCopy('ko').sourceLabel, |
| 58 | + getMcpCopy('ko').page.setupTitle, |
| 59 | + getPlanModeCopy('ko').proposal.execute, |
| 60 | + getBotSettingsCopy('ko').overview.reload, |
| 61 | + getDailyReviewSettingsCopy('ko').aria, |
| 62 | + getDataSettingsCopy('ko').backupTitle, |
| 63 | + getHealthCenterCopy('ko').title, |
| 64 | + getMemorySettingsCopy('ko').text.title, |
| 65 | + getSettingsNavigationCopy('ko').sections.general.label, |
| 66 | + getSettingsProjectsCopy('ko').runtimeHost.title, |
| 67 | + getProviderSettingsCopy('ko').detail.modelKey, |
| 68 | + getSettingsSharedCopy('ko').modalLabel, |
| 69 | + getSubagentSettingsCopy('ko').section.title, |
| 70 | + getSettingsTasksCopy('ko').listAria, |
| 71 | + getUsageSettingsCopy('ko').details, |
| 72 | + getWebSearchSettingsCopy('ko').search, |
| 73 | + ]; |
| 74 | + |
| 75 | + for (const value of values) assert.match(value, /[가-힣]/u); |
| 76 | + const proxyDisabled: SettingsTestResult = { ok: false, code: 'proxy_disabled', message: '' }; |
| 77 | + assert.match(settingsTestResultMessage(proxyDisabled, 'ko'), /[가-힣]/u); |
| 78 | +}); |
| 79 | + |
| 80 | +test('Korean catalog additions do not leak Korean into English or leave key dynamic copy in English', () => { |
| 81 | + const catalogs = [ |
| 82 | + getArtifactCopy, |
| 83 | + getBrowserCopy, |
| 84 | + getDesktopConversationCopy, |
| 85 | + getExternalSessionImportCopy, |
| 86 | + getMcpCopy, |
| 87 | + getPlanModeCopy, |
| 88 | + getBotSettingsCopy, |
| 89 | + getDailyReviewSettingsCopy, |
| 90 | + getDataSettingsCopy, |
| 91 | + getHealthCenterCopy, |
| 92 | + getMemorySettingsCopy, |
| 93 | + getSettingsNavigationCopy, |
| 94 | + getSettingsProjectsCopy, |
| 95 | + getProviderSettingsCopy, |
| 96 | + getSettingsSharedCopy, |
| 97 | + getSubagentSettingsCopy, |
| 98 | + getSettingsTasksCopy, |
| 99 | + getUsageSettingsCopy, |
| 100 | + getWebSearchSettingsCopy, |
| 101 | + ]; |
| 102 | + for (const getCopy of catalogs) { |
| 103 | + assert.equal(collectStrings(getCopy('en')).some((value) => /[가-힣]/u.test(value)), false); |
| 104 | + } |
| 105 | + |
| 106 | + assert.match(getMemorySettingsCopy('ko').text.localFile, /[가-힣]/u); |
| 107 | + assert.match(getProviderSettingsCopy('ko').panel.loadFailed, /[가-힣]/u); |
| 108 | + assert.match(getProviderSettingsCopy('ko').oauthFlow.refreshFailed, /[가-힣]/u); |
| 109 | + assert.match(getHealthCenterCopy('ko').signalMessage({ |
| 110 | + id: 'connection:test:runtime', |
| 111 | + label: '테스트', |
| 112 | + scope: 'llm_connection', |
| 113 | + layer: 'runtime_probe', |
| 114 | + status: 'ok', |
| 115 | + source: 'runtime_probe', |
| 116 | + checkedAt: 0, |
| 117 | + message: '', |
| 118 | + } satisfies HealthSignal), /[가-힣]/u); |
| 119 | + const inspector = getDesktopConversationCopy('ko').inspector; |
| 120 | + assert.equal(inspector.callKind('daily_review'), '일일 검토'); |
| 121 | + assert.equal(inspector.permissionDecision('allow'), '허용됨'); |
| 122 | + assert.equal(inspector.retries(2), '2회 재시도'); |
| 123 | + assert.equal(getMcpCopy('ko').toast.importedDetail(2), '2 서버를 가져왔습니다.'); |
| 124 | + assert.equal(getMcpCopy('ko').row.tools(2), '2개 도구'); |
| 125 | + assert.equal(getArtifactCopy('ko').preview.externalLinks(2), '이 미리보기에서는 외부 링크가 비활성화되었습니다. · 외부 링크 2개'); |
| 126 | + assert.equal(getUsageSettingsCopy('ko').recordCount(2), '2개 기록'); |
| 127 | + assert.deepEqual(getSettingsPreferencesCopy('en').personalization.localeOptions.at(-1), ['ko', '한국어']); |
| 128 | + assert.deepEqual(getSettingsPreferencesCopy('zh').personalization.localeOptions.at(-1), ['ko', '한국어']); |
| 129 | +}); |
| 130 | + |
| 131 | +test('Korean representative surfaces preserve interpolation', () => { |
| 132 | + const plan = getPlanModeCopy('ko'); |
| 133 | + const conversation = getDesktopConversationCopy('ko'); |
| 134 | + |
| 135 | + assert.equal(plan.abandonConfirmation.description('Release plan'), '“Release plan”의 실행 기록은 유지되지만 다시 시작할 수 없습니다.'); |
| 136 | + assert.equal(plan.execution.stepCount(2, 3), '2/3단계'); |
| 137 | + assert.equal(conversation.actions.branchCreatedDescription('Release branch'), '새 작업: Release branch'); |
| 138 | +}); |
0 commit comments