fix(i18n): refine Chinese prose and prompt validation

This commit is contained in:
Tianyi Cui
2026-07-15 20:39:24 +08:00
parent 168a3b9fe7
commit 3383c20c63
12 changed files with 42 additions and 26 deletions
+9
View File
@@ -40,6 +40,15 @@ describe('translation prompt rendering', () => {
terminology: 'terms',
})).toThrow('does not match source language Chinese')
})
it('rejects malformed template placeholders before injecting rule contents', () => {
expect(() => renderTranslationPrompt(document.replace('{{source_lang}}', '{{source-lang}}'), {
sourceLanguage: 'English',
sourceFilename: 'guide.md',
translationRules: 'A literal {{source_lang}} in injected rules.',
terminology: '| English | 中文 |',
})).toThrow('template contains malformed placeholder syntax')
})
})
describe('translation response XML', () => {