Skip to content

Commit 40ae7ce

Browse files
committed
feat(i18n): translate callout titles in README
Closes #259
1 parent 62cff37 commit 40ae7ce

3 files changed

Lines changed: 31 additions & 7 deletions

File tree

app/components/Readme.vue

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,23 @@ 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+
:data-i18n-note="$t('package.readme.callout.note')"
66+
:data-i18n-tip="$t('package.readme.callout.tip')"
67+
:data-i18n-important="$t('package.readme.callout.important')"
68+
:data-i18n-warning="$t('package.readme.callout.warning')"
69+
:data-i18n-caution="$t('package.readme.callout.caution')"
6570
@click="handleClick"
6671
/>
6772
</template>
6873

6974
<style scoped>
7075
/* README prose styling */
7176
.readme {
77+
--i18n-note: attr(data-i18n-note);
78+
--i18n-tip: attr(data-i18n-tip);
79+
--i18n-important: attr(data-i18n-important);
80+
--i18n-warning: attr(data-i18n-warning);
81+
--i18n-caution: attr(data-i18n-caution);
7282
color: var(--fg-muted);
7383
line-height: 1.75;
7484
/* Prevent horizontal overflow on mobile */
@@ -333,7 +343,7 @@ function handleClick(event: MouseEvent) {
333343
background: rgba(59, 130, 246, 0.05);
334344
}
335345
.readme :deep(blockquote[data-callout='note']::before) {
336-
content: 'Note';
346+
content: var(--i18n-note);
337347
color: #3b82f6;
338348
}
339349
.readme :deep(blockquote[data-callout='note']::after) {
@@ -348,7 +358,7 @@ function handleClick(event: MouseEvent) {
348358
background: rgba(34, 197, 94, 0.05);
349359
}
350360
.readme :deep(blockquote[data-callout='tip']::before) {
351-
content: 'Tip';
361+
content: var(--i18n-tip);
352362
color: #22c55e;
353363
}
354364
.readme :deep(blockquote[data-callout='tip']::after) {
@@ -363,7 +373,7 @@ function handleClick(event: MouseEvent) {
363373
background: rgba(168, 85, 247, 0.05);
364374
}
365375
.readme :deep(blockquote[data-callout='important']::before) {
366-
content: 'Important';
376+
content: var(--i18n-important);
367377
color: var(--syntax-fn);
368378
}
369379
.readme :deep(blockquote[data-callout='important']::after) {
@@ -378,7 +388,7 @@ function handleClick(event: MouseEvent) {
378388
background: rgba(234, 179, 8, 0.05);
379389
}
380390
.readme :deep(blockquote[data-callout='warning']::before) {
381-
content: 'Warning';
391+
content: var(--i18n-warning);
382392
color: #eab308;
383393
}
384394
.readme :deep(blockquote[data-callout='warning']::after) {
@@ -393,7 +403,7 @@ function handleClick(event: MouseEvent) {
393403
background: rgba(239, 68, 68, 0.05);
394404
}
395405
.readme :deep(blockquote[data-callout='caution']::before) {
396-
content: 'Caution';
406+
content: var(--i18n-caution);
397407
color: #ef4444;
398408
}
399409
.readme :deep(blockquote[data-callout='caution']::after) {

i18n/locales/pl-PL.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,14 @@
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
},
209216
"keywords_title": "Słowa kluczowe",
210217
"compatibility": "Zgodność",

lunaria/files/pl-PL.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,14 @@
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
},
209216
"keywords_title": "Słowa kluczowe",
210217
"compatibility": "Zgodność",

0 commit comments

Comments
 (0)