Skip to content

Commit 1e17569

Browse files
feat(i18n): translate callout titles in README (#934)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 7237af9 commit 1e17569

File tree

6 files changed

+60
-16
lines changed

6 files changed

+60
-16
lines changed

app/components/Readme.vue

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ function handleClick(event: MouseEvent) {
6262
<article
6363
class="readme prose prose-invert max-w-[70ch] lg:max-w-none px-1"
6464
v-html="html"
65+
:style="{
66+
'--i18n-note': '\'' + $t('package.readme.callout.note') + '\'',
67+
'--i18n-tip': '\'' + $t('package.readme.callout.tip') + '\'',
68+
'--i18n-important': '\'' + $t('package.readme.callout.important') + '\'',
69+
'--i18n-warning': '\'' + $t('package.readme.callout.warning') + '\'',
70+
'--i18n-caution': '\'' + $t('package.readme.callout.caution') + '\'',
71+
}"
6572
@click="handleClick"
6673
/>
6774
</template>
@@ -333,7 +340,7 @@ function handleClick(event: MouseEvent) {
333340
background: rgba(59, 130, 246, 0.05);
334341
}
335342
.readme :deep(blockquote[data-callout='note']::before) {
336-
content: 'Note';
343+
content: var(--i18n-note, 'Note');
337344
color: #3b82f6;
338345
}
339346
.readme :deep(blockquote[data-callout='note']::after) {
@@ -348,7 +355,7 @@ function handleClick(event: MouseEvent) {
348355
background: rgba(34, 197, 94, 0.05);
349356
}
350357
.readme :deep(blockquote[data-callout='tip']::before) {
351-
content: 'Tip';
358+
content: var(--i18n-tip, 'Tip');
352359
color: #22c55e;
353360
}
354361
.readme :deep(blockquote[data-callout='tip']::after) {
@@ -363,7 +370,7 @@ function handleClick(event: MouseEvent) {
363370
background: rgba(168, 85, 247, 0.05);
364371
}
365372
.readme :deep(blockquote[data-callout='important']::before) {
366-
content: 'Important';
373+
content: var(--i18n-important, 'Important');
367374
color: var(--syntax-fn);
368375
}
369376
.readme :deep(blockquote[data-callout='important']::after) {
@@ -378,7 +385,7 @@ function handleClick(event: MouseEvent) {
378385
background: rgba(234, 179, 8, 0.05);
379386
}
380387
.readme :deep(blockquote[data-callout='warning']::before) {
381-
content: 'Warning';
388+
content: var(--i18n-warning, 'Warning');
382389
color: #eab308;
383390
}
384391
.readme :deep(blockquote[data-callout='warning']::after) {
@@ -393,7 +400,7 @@ function handleClick(event: MouseEvent) {
393400
background: rgba(239, 68, 68, 0.05);
394401
}
395402
.readme :deep(blockquote[data-callout='caution']::before) {
396-
content: 'Caution';
403+
content: var(--i18n-caution, 'Caution');
397404
color: #ef4444;
398405
}
399406
.readme :deep(blockquote[data-callout='caution']::after) {

i18n/locales/en.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,14 @@
208208
"title": "Readme",
209209
"no_readme": "No README available.",
210210
"view_on_github": "View on GitHub",
211-
"toc_title": "Outline"
211+
"toc_title": "Outline",
212+
"callout": {
213+
"note": "Note",
214+
"tip": "Tip",
215+
"important": "Important",
216+
"warning": "Warning",
217+
"caution": "Caution"
218+
}
212219
},
213220
"provenance_section": {
214221
"title": "Provenance",

i18n/locales/pl-PL.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"chat": "czat"
2020
},
2121
"search": {
22-
"title": "Wyszukiwanie",
2322
"label": "Szukaj pakietów npm",
2423
"placeholder": "szukaj pakietów...",
2524
"button": "szukaj",
@@ -28,6 +27,7 @@
2827
"found_packages": "Nie znaleziono pakietów | Znaleziono 1 pakiet | Znaleziono {count} pakiety | Znaleziono {count} pakietów | Znaleziono {count} pakietów",
2928
"updating": "(aktualizowanie...)",
3029
"no_results": "Nie znaleziono pakietów dla \"{query}\"",
30+
"title": "Wyszukiwanie",
3131
"not_taken": "{name} jest wolne",
3232
"claim_prompt": "Zajmij tę nazwę pakietu w npm",
3333
"claim_button": "Zajmij \"{name}\"",
@@ -73,12 +73,12 @@
7373
"theme_light": "Jasny",
7474
"theme_dark": "Ciemny",
7575
"theme_system": "Systemowy",
76-
"background_themes": "Odcień tła",
7776
"language": "Język",
7877
"help_translate": "Pomóż tłumaczyć npmx",
7978
"accent_colors": "Kolory akcentu",
8079
"clear_accent": "Wyczyść kolor akcentu",
81-
"translation_progress": "Postęp tłumaczenia"
80+
"translation_progress": "Postęp tłumaczenia",
81+
"background_themes": "Odcień tła"
8282
},
8383
"i18n": {
8484
"missing_keys": "{count} brakujących tłumaczeń | {count} brakujące tłumaczenie | {count} brakujące tłumaczenia | {count} brakujących tłumaczeń | {count} brakujących tłumaczeń",
@@ -204,8 +204,16 @@
204204
"title": "README",
205205
"no_readme": "Brak README.",
206206
"view_on_github": "Zobacz na GitHub",
207-
"toc_title": "Spis treści"
207+
"toc_title": "Spis treści",
208+
"callout": {
209+
"note": "Notatka",
210+
"tip": "Wskazówka",
211+
"important": "Ważne",
212+
"warning": "Uwaga",
213+
"caution": "Ostrożnie"
214+
}
208215
},
216+
"provenance_section": {},
209217
"keywords_title": "Słowa kluczowe",
210218
"compatibility": "Zgodność",
211219
"card": {

lunaria/files/en-GB.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,14 @@
208208
"title": "Readme",
209209
"no_readme": "No README available.",
210210
"view_on_github": "View on GitHub",
211-
"toc_title": "Outline"
211+
"toc_title": "Outline",
212+
"callout": {
213+
"note": "Note",
214+
"tip": "Tip",
215+
"important": "Important",
216+
"warning": "Warning",
217+
"caution": "Caution"
218+
}
212219
},
213220
"provenance_section": {
214221
"title": "Provenance",

lunaria/files/en-US.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,14 @@
208208
"title": "Readme",
209209
"no_readme": "No README available.",
210210
"view_on_github": "View on GitHub",
211-
"toc_title": "Outline"
211+
"toc_title": "Outline",
212+
"callout": {
213+
"note": "Note",
214+
"tip": "Tip",
215+
"important": "Important",
216+
"warning": "Warning",
217+
"caution": "Caution"
218+
}
212219
},
213220
"provenance_section": {
214221
"title": "Provenance",

lunaria/files/pl-PL.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"chat": "czat"
2020
},
2121
"search": {
22-
"title": "Wyszukiwanie",
2322
"label": "Szukaj pakietów npm",
2423
"placeholder": "szukaj pakietów...",
2524
"button": "szukaj",
@@ -28,6 +27,7 @@
2827
"found_packages": "Nie znaleziono pakietów | Znaleziono 1 pakiet | Znaleziono {count} pakiety | Znaleziono {count} pakietów | Znaleziono {count} pakietów",
2928
"updating": "(aktualizowanie...)",
3029
"no_results": "Nie znaleziono pakietów dla \"{query}\"",
30+
"title": "Wyszukiwanie",
3131
"not_taken": "{name} jest wolne",
3232
"claim_prompt": "Zajmij tę nazwę pakietu w npm",
3333
"claim_button": "Zajmij \"{name}\"",
@@ -73,12 +73,12 @@
7373
"theme_light": "Jasny",
7474
"theme_dark": "Ciemny",
7575
"theme_system": "Systemowy",
76-
"background_themes": "Odcień tła",
7776
"language": "Język",
7877
"help_translate": "Pomóż tłumaczyć npmx",
7978
"accent_colors": "Kolory akcentu",
8079
"clear_accent": "Wyczyść kolor akcentu",
81-
"translation_progress": "Postęp tłumaczenia"
80+
"translation_progress": "Postęp tłumaczenia",
81+
"background_themes": "Odcień tła"
8282
},
8383
"i18n": {
8484
"missing_keys": "{count} brakujących tłumaczeń | {count} brakujące tłumaczenie | {count} brakujące tłumaczenia | {count} brakujących tłumaczeń | {count} brakujących tłumaczeń",
@@ -204,8 +204,16 @@
204204
"title": "README",
205205
"no_readme": "Brak README.",
206206
"view_on_github": "Zobacz na GitHub",
207-
"toc_title": "Spis treści"
207+
"toc_title": "Spis treści",
208+
"callout": {
209+
"note": "Notatka",
210+
"tip": "Wskazówka",
211+
"important": "Ważne",
212+
"warning": "Uwaga",
213+
"caution": "Ostrożnie"
214+
}
208215
},
216+
"provenance_section": {},
209217
"keywords_title": "Słowa kluczowe",
210218
"compatibility": "Zgodność",
211219
"card": {

0 commit comments

Comments
 (0)