Files
orca/config/scripts/locale-count-fragment-separator.test.mjs
T
JeongUk Park fc181a8496 fix(i18n): restore count separators in terminal theme picker for CJK locales (#9935)
The theme picker count row concatenates "Showing {count}" directly with
the " of {{value0}}" fragment. The ko/ja/zh translations dropped the
fragment's leading separator, so the shown and total counts fused
(e.g. Korean rendered "표시 중 3030 중" instead of "표시 중 30/30").

Restore a slash separator for the total-count fragment and the leading
space for the search-match fragment in ko/ja/zh, in both the runtime
catalogs and the key-override sources so catalog regeneration keeps the
repaired values. Add a regression test covering both fragments.

🤖 Generated with Claude Code
2026-07-24 00:26:39 -07:00

40 lines
1.5 KiB
JavaScript

import { describe, expect, it } from 'vitest'
import { repairTranslatedValue } from './locale-translation-policy.mjs'
// The theme-picker count row renders "Showing {count}" immediately followed by one of these
// fragments, so translations must keep a leading separator or the numbers fuse ("표시 중 3030 중").
describe('locale-count-fragment-separator', () => {
it('keeps a slash between shown and total theme counts in CJK locales', () => {
const brokenByLocale = { ko: '{{value0}} 중', ja: '{{value0}}の', zh: '{{value0}} 的' }
for (const [locale, localeValue] of Object.entries(brokenByLocale)) {
expect(
repairTranslatedValue({
key: 'auto.components.settings.SettingsFormControls.cb330ef7f8',
enValue: ' of {{value0}}',
localeValue,
locale
})
).toBe('/{{value0}}')
}
})
it('keeps a leading space before the search-match fragment in CJK locales', () => {
const cases = [
['ko', '"{{value0}}"과(와) 일치', ' "{{value0}}"과(와) 일치'],
['ja', '「{{value0}}」に一致', ' 「{{value0}}」に一致'],
['zh', '匹配“{{value0}}”', ' 匹配“{{value0}}”']
]
for (const [locale, localeValue, repaired] of cases) {
expect(
repairTranslatedValue({
key: 'auto.components.settings.SettingsFormControls.c822571b2e',
enValue: ' matching "{{value0}}"',
localeValue,
locale
})
).toBe(repaired)
}
})
})