Skip to content

Commit 019d358

Browse files
committed
Fix localization for Playground cards
1 parent bbd8665 commit 019d358

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

src/components/PlaygroundCards.tsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,23 @@ const PlaygroundCard: FC<
1212
Playground & {
1313
lang: Locale;
1414
}
15-
> = ({ lang, name, image, url }) => (
16-
<div className="grid gap-2">
17-
<Heading as="h3">{name}</Heading>
18-
<img src={`/assets/playgrounds/${image}`} alt={`Vorschau des Playground ${name}'s`} />
19-
<div className="text-center">
20-
<KolLinkButton
21-
_href={url}
22-
_label={MESSAGES[lang].components.playgroundCards.button}
23-
_target="${image}"
24-
></KolLinkButton>
15+
> = ({ lang, name, image, url }) => {
16+
const imagePath = `${lang === 'en' ? '/en' : ''}/assets/playgrounds/${image}`;
17+
18+
return (
19+
<div className="grid gap-2">
20+
<Heading as="h3">{name}</Heading>
21+
<img src={imagePath} alt={MESSAGES[lang].components.playgroundCards.previewAlt(name)} />
22+
<div className="text-center">
23+
<KolLinkButton
24+
_href={url}
25+
_label={MESSAGES[lang].components.playgroundCards.button}
26+
_target="${image}"
27+
></KolLinkButton>
28+
</div>
2529
</div>
26-
</div>
27-
);
30+
);
31+
};
2832

2933
export type PlaygroundCardsProps = {
3034
lang?: Locale;

src/shares/language.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const MESSAGES = {
99
components: {
1010
playgroundCards: {
1111
button: 'Try it out now!',
12+
previewAlt: (name: string) => `Preview for playground ${name}`,
1213
},
1314
propertiesTable: {
1415
meta: 'Only applies to types who actually mean variants.',
@@ -21,6 +22,7 @@ export const MESSAGES = {
2122
components: {
2223
playgroundCards: {
2324
button: 'Jetzt ausprobieren!',
25+
previewAlt: (name: string) => `Vorschau des Playground ${name}`,
2426
},
2527
propertiesTable: {
2628
meta: 'Betrifft nur Typen, die eigentlich Varianten meinen.',

0 commit comments

Comments
 (0)