Skip to content

Commit 1a4d249

Browse files
docs-botV-halfaro
andauthored
Add translation corrections for missing-space Liquid tags and Russian inflected data tag (#64563)
Co-authored-by: Hector A. <v-halfaro@github.com>
1 parent aa2396c commit 1a4d249

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ export function correctTranslatedContentStrings(
5959
}
6060

6161
content = content.replace(/\{%(-?)data (variables|reusables)\./g, '{%$1 data $2.')
62+
// Runs before the language blocks, so the French orphan-endif check sees the spaced form.
63+
content = content.replace(/\{%(-?)ifversion /g, '{%$1 ifversion ')
6264

6365
if (context.relativePath?.endsWith('/securely-using-pull_request_target.md')) {
6466
content = content.replace(
@@ -905,6 +907,7 @@ export function correctTranslatedContentStrings(
905907
content = content.replaceAll('{% данных.', '{% data variables.')
906908
content = content.replaceAll('{% data переменных.', '{% data variables.')
907909
content = content.replaceAll('{% переменным данных.', '{% data variables.')
910+
content = content.replaceAll('{% переменными данных.', '{% data variables.')
908911
content = content.replaceAll('{% переменных данных.', '{% data variables.')
909912
content = content.replaceAll('{% .dependency-review.', '{% data variables.dependency-review.')
910913
content = content.replaceAll('{% .code-scanning.', '{% data variables.code-scanning.')

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3838,6 +3838,24 @@ Para más información, consulta "[AUTOTITLE](/path)".
38383838
})
38393839
})
38403840

3841+
describe('Liquid tags missing a space or with inflected Russian data', () => {
3842+
test.each([
3843+
['ko', '{%ifversion fpt or ghec %}x{% endif %}', '{% ifversion fpt or ghec %}x{% endif %}'],
3844+
['fr', '{%ifversion ghec %}x{% endif %}', '{% ifversion ghec %}x{% endif %}'],
3845+
['ko', '{%-ifversion ghes %}x{%- endif %}', '{%- ifversion ghes %}x{%- endif %}'],
3846+
['ko', '{%data variables.product.github %}', '{% data variables.product.github %}'],
3847+
['ko', '{%data reusables.foo.bar %}', '{% data reusables.foo.bar %}'],
3848+
['ru', '{% переменными данных.product.github %}', '{% data variables.product.github %}'],
3849+
])('fixes %s: %s', (code, before, after) => {
3850+
expect(fix(before, code)).toBe(after)
3851+
})
3852+
3853+
test('leaves already-correct tags unchanged', () => {
3854+
const ok = '{% ifversion ghec %}{% data variables.product.github %}{% endif %}'
3855+
for (const code of ['ko', 'ru']) expect(fix(ok, code)).toBe(ok)
3856+
})
3857+
})
3858+
38413859
describe('French translated endwarning', () => {
38423860
test.each(['{% fin avertissement %}', '{%- fin avertissement -%}'])(
38433861
'rewrites %s so the alert pair is stripped cleanly',

0 commit comments

Comments
 (0)