mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: some locale links
This commit is contained in:
1 parent
eb5527706e
commit
8203db3dc2
4 files changed
+47
-12
No files matched your search
@@ -2,8 +2,10 @@
|
||||
import { assertSecret, fetchGameDefinitions } from '@blitzkit/core';
|
||||
import { Code, Flex, Heading, Link, Text } from '@radix-ui/themes';
|
||||
import packageJson from '../../../../package.json';
|
||||
import { LinkI18n } from './LinkI18n';
|
||||
|
||||
const gameDefinitions = await fetchGameDefinitions();
|
||||
const { locale } = Astro.params;
|
||||
---
|
||||
|
||||
<style>
|
||||
@@ -13,6 +15,7 @@ const gameDefinitions = await fetchGameDefinitions();
|
||||
</style>
|
||||
|
||||
<Flex className="footer" gap="6" p="6" direction="column" align="center">
|
||||
{locale}
|
||||
<Flex
|
||||
align="center"
|
||||
justify="between"
|
||||
@@ -68,7 +71,9 @@ const gameDefinitions = await fetchGameDefinitions();
|
||||
sm: 'start',
|
||||
}}
|
||||
>
|
||||
<Link href="/docs/about/credits" color="gray"> Credits </Link>
|
||||
<LinkI18n {locale} href="/docs/about/credits" color="gray"
|
||||
>Credits</LinkI18n
|
||||
>
|
||||
<Link
|
||||
href="https://discord.gg/nDt7AjGJQH"
|
||||
target="_blank"
|
||||
@@ -83,7 +88,8 @@ const gameDefinitions = await fetchGameDefinitions();
|
||||
>
|
||||
GitHub
|
||||
</Link>
|
||||
<Link href="/docs/patches" color="gray"> Patches </Link>
|
||||
<LinkI18n {locale} href="/docs/patches" color="gray">Patches</LinkI18n
|
||||
>
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
@@ -101,12 +107,12 @@ const gameDefinitions = await fetchGameDefinitions();
|
||||
>
|
||||
<Heading size="3">Legal</Heading>
|
||||
<Flex direction="column">
|
||||
<Link href="/docs/legal/privacy-policy" color="gray">
|
||||
<LinkI18n {locale} href="/docs/legal/privacy-policy" color="gray">
|
||||
Privacy policy
|
||||
</Link>
|
||||
<Link href="/docs/legal/terms-of-service" color="gray">
|
||||
</LinkI18n>
|
||||
<LinkI18n {locale} href="/docs/legal/terms-of-service" color="gray">
|
||||
Terms of service
|
||||
</Link>
|
||||
</LinkI18n>
|
||||
</Flex>
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { Link, type LinkProps } from '@radix-ui/themes';
|
||||
import { getBestLocale } from '../core/i18n/getBestLocale';
|
||||
|
||||
type LinkI18nProps = LinkProps & {
|
||||
locale: string | undefined;
|
||||
};
|
||||
|
||||
export function LinkI18n({ locale, href, ...props }: LinkI18nProps) {
|
||||
const bestLocale = getBestLocale();
|
||||
const resolvedLocale = locale ?? bestLocale;
|
||||
const prefix = resolvedLocale === undefined ? '' : `/${resolvedLocale}`;
|
||||
|
||||
return (
|
||||
<Link
|
||||
href={href === undefined ? undefined : `${prefix}${href}`}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user