Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions config/scripts/locale-generic-ui-terms.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// Ordinary UI vocabulary that reads like a brand but is not one. Every locale should translate
// these, so the policy must neither pin the whole value to English nor revert the translation
// inside a sentence. The product-name homonyms (Continue.dev, the agent entries) stay Latin
// through ENGLISH_ONLY_KEY_PREFIXES, which matches on the catalog key rather than the word.

// Renderings a locale is expected to use. They are translations, never machine-translation
// errors, so a brand revert must leave them alone. Nonsense forms that share the same English
// term (zh 回购 "repurchase agreement", ja 端子 "electrical connector", es "Comprometerse")
// stay in BRAND_MISTRANSLATIONS and keep getting reverted.
const GENERIC_TERM_FAMILIES = [
{
terms: ['Agent', 'Agents', 'agent', 'agents'],
renderings: {
ko: ['에이전트'],
ja: ['エージェント'],
zh: ['代理', '智能体'],
es: ['Agente', 'agente', 'Agentes', 'agentes']
}
},
{
terms: ['Commit', 'Commits', 'commit', 'commits'],
renderings: {
ko: ['커밋'],
ja: ['コミット'],
zh: ['提交'],
es: [
'Confirmación',
'confirmación',
'Confirmaciones',
'confirmaciones',
'Confirmar',
'confirmar'
]
}
},
{
terms: ['Continue'],
renderings: {
ko: ['계속하다', '계속'],
ja: ['続ける', '続行'],
zh: ['继续'],
es: ['Continuar', 'continuar']
}
},
{
terms: ['Repo', 'Repos', 'repo', 'repos'],
renderings: {
ko: ['저장소', '레포'],
ja: ['リポジトリ', 'リポ'],
zh: ['存储库', '仓库'],
es: ['Repositorio', 'repositorio', 'Repositorios', 'repositorios']
}
},
{
terms: ['Terminal', 'Terminals', 'terminal', 'terminals'],
renderings: {
ko: ['터미널'],
ja: ['ターミナル'],
zh: ['终端'],
es: ['Terminales', 'terminales']
}
}
]

export const LOCALIZABLE_GENERIC_TERMS = new Set(
GENERIC_TERM_FAMILIES.flatMap((family) => family.terms)
)

const RENDERINGS_BY_TERM = new Map(
GENERIC_TERM_FAMILIES.flatMap((family) => family.terms.map((term) => [term, family.renderings]))
)

export function isLocalizableGenericTerm(term) {
return LOCALIZABLE_GENERIC_TERMS.has(term)
}

export function isCanonicalGenericRendering(term, locale, form) {
return RENDERINGS_BY_TERM.get(term)?.[locale]?.includes(form) ?? false
}

export function canonicalGenericRenderings(locale) {
return GENERIC_TERM_FAMILIES.flatMap((family) =>
(family.renderings[locale] ?? []).map((form) => ({ form, terms: family.terms }))
)
}

function spansOf(value, needle) {
const spans = []
for (let at = value.indexOf(needle); at !== -1; at = value.indexOf(needle, at + 1)) {
spans.push([at, at + needle.length])
}
return spans
}

// Why: zh 终端子进程 ("terminal sub-process") contains 端子, so a blind revert of the
// electrical-connector mistranslation would cut a valid word in half.
export function overlapsCanonicalRendering(term, locale, value, start, end) {
const renderings = RENDERINGS_BY_TERM.get(term)?.[locale] ?? []
return renderings.some((form) =>
spansOf(value, form).some(([from, to]) => start < to && from < end)
)
}
174 changes: 174 additions & 0 deletions config/scripts/locale-generic-ui-terms.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
import { describe, expect, it } from 'vitest'

import { LOCALIZABLE_GENERIC_TERMS } from './locale-generic-ui-terms.mjs'
import { NEVER_TRANSLATE_VALUES, repairTranslatedValue } from './locale-translation-policy.mjs'

// Why: #12113 — repair-locale-catalog rewrote ~2000 translated values back to English because
// generic UI words (agent, terminal, commit, repo, Continue) were treated as brands. These pin
// the boundary: generic words stay translated, real brand names stay Latin.
describe('locale generic UI terms', () => {
it('keeps a translated generic term when the whole value is that term', () => {
expect(
repairTranslatedValue({
key: 'auto.components.settings.AppearancePane.terminalTitle',
enValue: 'Terminal',
localeValue: '터미널',
locale: 'ko'
})
).toBe('터미널')
expect(
repairTranslatedValue({
key: 'auto.components.settings.QuickCommandsPane.4ccc63da87',
enValue: 'Agent',
localeValue: '에이전트',
locale: 'ko'
})
).toBe('에이전트')
expect(
repairTranslatedValue({
key: 'auto.components.mobile.MobileHero.a8fb43cf1c',
enValue: 'Continue',
localeValue: '继续',
locale: 'zh'
})
).toBe('继续')
})

it('keeps a translated generic term inside a sentence', () => {
expect(
repairTranslatedValue({
key: 'auto.components.settings.EditorFontSection.matchTerminal',
enValue: 'Match terminal font',
localeValue: '터미널 글꼴과 동일',
locale: 'ko'
})
).toBe('터미널 글꼴과 동일')
expect(
repairTranslatedValue({
key: 'auto.components.settings.ExperimentalPane.agentDashboard.toggleLabel',
enValue: 'Toggle Agent Dashboard',
localeValue: '에이전트 대시보드 전환',
locale: 'ko'
})
).toBe('에이전트 대시보드 전환')
expect(
repairTranslatedValue({
key: 'components.agentSessionContinuation.dialogTitle',
enValue: 'Continue in New Session',
localeValue: '新しいセッションで続ける',
locale: 'ja'
})
// 新しい → 新規 is an unrelated phrase fix; 続ける is what must survive.
).toBe('新規セッションで続ける')
})

it('still reverts real brand names that machine translation localized', () => {
expect(
repairTranslatedValue({
key: 'auto.stats.StatsPane.7d26110cea',
enValue: 'Codex',
localeValue: '사본',
locale: 'ko'
})
).toBe('Codex')
expect(
repairTranslatedValue({
key: 'auto.components.settings.appearance.search.9ae151b26b',
enValue: 'linear',
localeValue: '线性',
locale: 'zh'
})
).toBe('Linear')
expect(
repairTranslatedValue({
key: 'auto.components.settings.NetworkPane.tailscale',
enValue: 'Connect over Tailscale',
localeValue: '通过尾鳞连接',
locale: 'zh'
})
).toBe('通过 Tailscale 连接')
})

it('still reverts nonsense renderings of a generic term', () => {
// 端子 is an electrical connector, 回购 a repurchase agreement, Comprometerse "to pledge".
expect(
repairTranslatedValue({
key: 'auto.components.agent.AgentCombobox.986f946354',
enValue: 'Blank Terminal',
localeValue: '空白端子',
locale: 'zh'
})
).toBe('空白 Terminal')
expect(
repairTranslatedValue({
key: 'auto.components.right.sidebar.source.control.primary.action.ed93b4f14f',
enValue: 'Commit',
localeValue: 'Comprometerse',
locale: 'es'
})
).toBe('Commit')
expect(
repairTranslatedValue({
key: 'auto.components.LinearIssueMarkdownDescriptionEditor.d9c47069ef',
enValue: 'Markdown',
localeValue: '가격 인하',
locale: 'ko'
})
).toBe('Markdown')
})

it('does not cut a valid word that contains a nonsense rendering', () => {
// 终端子进程 is "terminal sub-process" — 端子 sits inside 终端 + 子.
expect(
repairTranslatedValue({
key: 'auto.components.settings.AdvancedNetworkSettingsSection.823e0f15b1',
enValue: 'Proxy URL for Orca network requests and local terminal subprocesses.',
localeValue: '用于 Orca 网络请求和本地终端子进程的代理 URL。',
locale: 'zh'
})
).toBe('用于 Orca 网络请求和本地终端子进程的代理 URL。')
})

it('still fills in a translation when the catalog holds English', () => {
expect(
repairTranslatedValue({
key: 'auto.components.feature.wall.BrowserAnimatedVisual.04096318ab',
enValue: 'Terminal 1',
localeValue: 'Terminal 1',
locale: 'ko'
})
).toBe('터미널 1')
expect(
repairTranslatedValue({
key: 'auto.store.slices.worktrees.889487d8bb',
enValue: 'Dismiss',
localeValue: '해고하다',
locale: 'ko'
})
).toBe('닫기')
})

it('keeps agent catalog product names in English by key, not by word', () => {
expect(
repairTranslatedValue({
key: 'auto.lib.agent.catalog.9e2a9bb87b',
enValue: 'Continue',
localeValue: '继续',
locale: 'zh'
})
).toBe('Continue')
expect(
repairTranslatedValue({
key: 'auto.lib.agent.catalog.760bc6883d',
enValue: 'Codex',
localeValue: '사본',
locale: 'ko'
})
).toBe('Codex')
})

it('does not list a generic term as never-translatable', () => {
const pinned = [...LOCALIZABLE_GENERIC_TERMS].filter((term) => NEVER_TRANSLATE_VALUES.has(term))
expect(pinned).toEqual([])
})
})
2 changes: 1 addition & 1 deletion config/scripts/locale-ja-value-overrides.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const JA_VALUE_OVERRIDES = {
'Pick a base branch below': '以下のベースブランチを選択',
'Choose floating workspace directory': 'フローティング ワークスペース ディレクトリを選択',
'Local project, Git repo, or folder with many repos':
'ローカルプロジェクト、Git repo、または多数の repos を含むフォルダー',
'ローカルプロジェクト、Git リポジトリ、または多数のリポジトリを含むフォルダー',
'Enter passphrase': 'パスフレーズを入力',
'Enter password': 'パスワードを入力',
'Enter the passphrase for': 'のパスフレーズを入力',
Expand Down
2 changes: 1 addition & 1 deletion config/scripts/locale-ko-key-overrides.json
Original file line number Diff line number Diff line change
Expand Up @@ -2727,7 +2727,7 @@
"ko": "이 SSH 대상의 원격 릴레이를 강제로 중지합니다. 이 대상의 활성 원격 terminals과 포트 포워딩이 종료됩니다."
},
"auto.components.settings.SshTargetForm.137e88ce8d": {
"ko": "연결 해제 후 릴레이가 terminals을 활성 상태로 유지하는 기간입니다. 기본값: 10800(3시간). 최대:"
"ko": "연결 해제 후 릴레이가 터미널을 활성 상태로 유지하는 기간입니다. 기본값: 10800(3시간). 최대:"
},
"auto.components.settings.SshTargetForm.2ee9bcd2e8": {
"ko": "server, deploy@server:2222, ssh://server"
Expand Down
2 changes: 1 addition & 1 deletion config/scripts/locale-ko-value-overrides.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export const KO_VALUE_OVERRIDES = {
'Install the Orca skill so agents know to use the Orca CLI.':
'에이전트가 Orca CLI를 사용하도록 Orca 스킬을 설치하세요.',
'Local project, Git repo, or folder with many repos':
'로컬 프로젝트, Git repo 또는 repos가 많은 폴더',
'로컬 프로젝트, Git 저장소 또는 저장소가 많은 폴더',
'Linear, GitLab, Bitbucket, Azure DevOps, Gitea, and Jira live in Settings > Integrations.':
'Linear, GitLab, Bitbucket, Azure DevOps, Gitea 및 Jira는 설정 > 연동에 있습니다.',
'changed since you last approved. Re-review before it runs':
Expand Down
19 changes: 0 additions & 19 deletions config/scripts/locale-prose-term-exemptions.mjs

This file was deleted.

15 changes: 8 additions & 7 deletions config/scripts/locale-translation-policy-ko-round5.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('locale-translation-policy ko round 5', () => {
localeValue: '에이전트가 Orca CLI 사용 방법을 알 수 있도록 Orca 기술을 설치합니다.',
locale: 'ko'
})
).toBe('agents가 Orca CLI를 사용하도록 Orca 스킬을 설치하세요.')
).toBe('에이전트가 Orca CLI를 사용하도록 Orca 스킬을 설치하세요.')
expect(
repairTranslatedValue({
key: 'auto.components.editor.MarkdownPreview.322afab6ff',
Expand Down Expand Up @@ -92,23 +92,24 @@ describe('locale-translation-policy ko round 5', () => {
).toBe('파이프라인')
})

it('keeps protected workflow terms in English', () => {
// Why: #12113 — brand names stay Latin, but generic workflow nouns keep their Korean.
it('keeps brand names English and generic workflow terms translated', () => {
expect(
repairTranslatedValue({
key: 'auto.components.feature.wall.BrowserAnimatedVisual.04096318ab',
enValue: 'Terminal 1',
localeValue: '터미널 1',
locale: 'ko'
})
).toBe('Terminal 1')
).toBe('터미널 1')
expect(
repairTranslatedValue({
key: 'auto.components.skills.SkillsPage.38e0951c3a',
enValue: 'Agent Skills',
localeValue: '에이전트 스킬',
locale: 'ko'
})
).toBe('Agent 스킬')
).toBe('에이전트 스킬')
expect(
repairTranslatedValue({
key: 'auto.components.LinearIssueMarkdownDescriptionEditor.d9c47069ef',
Expand All @@ -124,23 +125,23 @@ describe('locale-translation-policy ko round 5', () => {
localeValue: '푸시되지 않은 커밋',
locale: 'ko'
})
).toBe('푸시되지 않은 commits')
).toBe('푸시되지 않은 커밋')
expect(
repairTranslatedValue({
key: 'auto.components.workspace.cleanup.WorkspaceCleanupDialog.0b1766738a',
enValue: 'Repo',
localeValue: '레포',
locale: 'ko'
})
).toBe('Repo')
).toBe('레포')
expect(
repairTranslatedValue({
key: 'auto.components.sidebar.add.repo.local.start.actions.fb4fc5380e',
enValue: 'Local project, Git repo, or folder with many repos',
localeValue: '로컬 프로젝트, Git 저장소 또는 저장소가 많은 폴더',
locale: 'ko'
})
).toBe('로컬 프로젝트, Git repo 또는 repos가 많은 폴더')
).toBe('로컬 프로젝트, Git 저장소 또는 저장소가 많은 폴더')
})

it('re-glues Korean particles after Latin terms without gluing content words', () => {
Expand Down
Loading