Skip to content

Commit 2db4cd9

Browse files
docs-botCopilothubwriterCopilot
authored
Add translation corrections for zh 数据reusables and ru warning tags (#63953)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: hubwriter <hubwriter@github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 405f673 commit 2db4cd9

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎src/languages/lib/correct-translation-content.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,8 @@ export function correctTranslatedContentStrings(
697697
content = content.replaceAll('{% 数据 variables', '{% data variables')
698698
content = content.replaceAll('{%数据variables', '{% data variables')
699699
content = content.replaceAll('{%数据 variables', '{% data variables')
700+
// The translator glued reusables to 数据, as in {% 数据reusables.apps.x %}.
701+
content = content.replace(/\{%(-?)\s*数据\s*reusables\./g, '{%$1 data reusables.')
700702
// Run the s. variant first, so the broader rule can't produce reusabless.
701703
content = content.replaceAll('{% 数据可重用s.', '{% data reusables.')
702704
content = content.replaceAll('{% 数据可重用', '{% data reusables')
@@ -899,6 +901,11 @@ export function correctTranslatedContentStrings(
899901
content = content.replaceAll('{%- конец %}', '{%- endif %}')
900902
content = content.replaceAll('{%- конец для %}', '{%- endfor %}')
901903
content = content.replaceAll('{% конец для %}', '{% endfor %}')
904+
// Translated alert tags, as in {% предупреждение %} ... {% конец предупреждения %}.
905+
content = content.replaceAll('{% предупреждение %}', '{% warning %}')
906+
content = content.replaceAll('{% пpeдyпpeждeниe %}', '{% warning %}')
907+
content = content.replaceAll('{% конец предупреждения %}', '{% endwarning %}')
908+
content = content.replaceAll('{% кoнeц пpeдyпpeждeния %}', '{% endwarning %}')
902909
content = content.replaceAll('{% заголовки строк %}', '{% rowheaders %}')
903910
content = content.replaceAll('{%- заголовки строк %}', '{%- rowheaders %}')
904911
content = content.replaceAll('{% windowsTerminal %}', '{% windowsterminal %}')

‎src/languages/tests/correct-translation-content.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3497,4 +3497,19 @@ Para más información, consulta "[AUTOTITLE](/path)".
34973497
expect(fix(ok, 'ko')).toBe(ok)
34983498
})
34993499
})
3500+
3501+
describe('Chinese glued 数据reusables and Russian alert tags', () => {
3502+
test('fixes {% 数据reusables. and leaves valid input unchanged', () => {
3503+
expect(fix('{% 数据reusables.apps.optional_feature_activation %}', 'zh')).toBe(
3504+
'{% data reusables.apps.optional_feature_activation %}',
3505+
)
3506+
const ok = '{% data reusables.apps.optional_feature_activation %}'
3507+
expect(fix(ok, 'zh')).toBe(ok)
3508+
})
3509+
3510+
test('fixes translated Russian warning tags (legacy alerts are stripped like other languages)', () => {
3511+
expect(fix('{% предупреждение %}\nx\n{% конец предупреждения %}', 'ru')).toBe('x')
3512+
expect(fix('{% warning %}\nx\n{% endwarning %}', 'ru')).toBe('x')
3513+
})
3514+
})
35003515
})

0 commit comments

Comments
 (0)