Skip to content

Commit 637f784

Browse files
heiskrCopilot
andauthored
Add note/warning/tip block tag corrections for es, de, fr (#60256)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 65fc55c commit 637f784

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ export function correctTranslatedContentStrings(
6262
content = content.replace(/\{%-? cuando /g, (match) => {
6363
return match.replace('cuando', 'when')
6464
})
65+
// Translated block tags
66+
content = content.replaceAll('{% nota %}', '{% note %}')
67+
content = content.replaceAll('{%- nota %}', '{%- note %}')
68+
content = content.replaceAll('{%- nota -%}', '{%- note -%}')
6569
}
6670

6771
if (context.code === 'ja') {
@@ -313,6 +317,8 @@ export function correctTranslatedContentStrings(
313317
content = content.replace(/([\w.-]+\.[\w.-]+\.[\w_]+) %данн\w*[^{]*\{%\s+\}/g, '{% data $1 %}')
314318
// Variant where `%}` appears BEFORE `данных`: `PATH %}данных {% .`
315319
content = content.replace(/([\w.-]+\.[\w.-]+\.[\w_]+) %\}данн\w*\s*\{%\s*\./g, '{% data $1 %}.')
320+
// Variant where path precedes `%{% data }`: `PATH %{% data }.`
321+
content = content.replace(/([\w.-]+\.[\w.-]+\.[\w_]+) %\{% data\s+\}/g, '{% data $1 %}')
316322

317323
// Translated octicon names
318324
content = content.replaceAll(
@@ -334,6 +340,16 @@ export function correctTranslatedContentStrings(
334340
content = content.replace(/\{%-? (?:ifversion|elsif) [^%]*?ou [^%]*?%\}/g, (match) => {
335341
return match.replace(/ ou /g, ' or ')
336342
})
343+
// Translated block tags
344+
content = content.replaceAll('{% remarque %}', '{% note %}')
345+
content = content.replaceAll('{%- remarque %}', '{%- note %}')
346+
content = content.replaceAll('{%- remarque -%}', '{%- note -%}')
347+
content = content.replaceAll('{% avertissement %}', '{% warning %}')
348+
content = content.replaceAll('{%- avertissement %}', '{%- warning %}')
349+
content = content.replaceAll('{%- avertissement -%}', '{%- warning -%}')
350+
content = content.replaceAll('{% conseil %}', '{% tip %}')
351+
content = content.replaceAll('{%- conseil %}', '{%- tip %}')
352+
content = content.replaceAll('{%- conseil -%}', '{%- tip -%}')
337353
}
338354

339355
if (context.code === 'ko') {
@@ -370,6 +386,16 @@ export function correctTranslatedContentStrings(
370386
content = content.replace(/\{%-? (?:ifversion|elsif) [^%]*?oder [^%]*?%\}/g, (match) => {
371387
return match.replace(/ oder /g, ' or ')
372388
})
389+
// Translated block tags
390+
content = content.replaceAll('{% Hinweis %}', '{% note %}')
391+
content = content.replaceAll('{%- Hinweis %}', '{%- note %}')
392+
content = content.replaceAll('{%- Hinweis -%}', '{%- note -%}')
393+
content = content.replaceAll('{% Warnung %}', '{% warning %}')
394+
content = content.replaceAll('{%- Warnung %}', '{%- warning %}')
395+
content = content.replaceAll('{%- Warnung -%}', '{%- warning -%}')
396+
content = content.replaceAll('{% Tipp %}', '{% tip %}')
397+
content = content.replaceAll('{%- Tipp %}', '{%- tip %}')
398+
content = content.replaceAll('{%- Tipp -%}', '{%- tip -%}')
373399
}
374400

375401
// --- Generic fixes (all languages) ---

0 commit comments

Comments
 (0)