mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: simplification
This commit is contained in:
1 parent
3f595d0d8a
commit
599b81934e
4 files changed
+66
-15
No files matched your search
@@ -1,6 +1,16 @@
|
|||||||
import { LOCALE_FILES } from '@blitzkit/core';
|
import { SupportedLocale } from '@blitzkit/core';
|
||||||
import { Locale } from 'discord.js';
|
import { Locale } from 'discord.js';
|
||||||
|
|
||||||
|
const DISCORD_SUPPORTED_LOCALES: Record<SupportedLocale, Locale> = {
|
||||||
|
en: Locale.EnglishUS,
|
||||||
|
es: Locale.SpanishES,
|
||||||
|
hr: Locale.Croatian,
|
||||||
|
pt: Locale.PortugueseBR,
|
||||||
|
ru: Locale.Russian,
|
||||||
|
uk: Locale.Ukrainian,
|
||||||
|
zh: Locale.ChineseCN,
|
||||||
|
};
|
||||||
|
|
||||||
export const SUPPORTED_DISCORD_LOCALES = Object.values(
|
export const SUPPORTED_DISCORD_LOCALES = Object.values(
|
||||||
LOCALE_FILES,
|
DISCORD_SUPPORTED_LOCALES,
|
||||||
) as Locale[];
|
);
|
||||||
@@ -1,5 +1,15 @@
|
|||||||
{
|
{
|
||||||
"common": {
|
"common": {
|
||||||
|
"locales": {
|
||||||
|
"en": "English",
|
||||||
|
"es": "Spanish",
|
||||||
|
"hr": "Croatian",
|
||||||
|
"pt": "Portuguese",
|
||||||
|
"ru": "Russian",
|
||||||
|
"uk": "Ukrainian",
|
||||||
|
"zh": "Chinese"
|
||||||
|
},
|
||||||
|
|
||||||
"wn8_percentile": {
|
"wn8_percentile": {
|
||||||
"0": "Very bad",
|
"0": "Very bad",
|
||||||
"1": "Bad",
|
"1": "Bad",
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
export const SUPPORTED_LOCALES = ['en', 'es', 'hr', 'ru', 'uk', 'cn'];
|
export const SUPPORTED_LOCALES = [
|
||||||
|
'en',
|
||||||
|
'es',
|
||||||
|
'hr',
|
||||||
|
'pt',
|
||||||
|
'ru',
|
||||||
|
'uk',
|
||||||
|
'zh',
|
||||||
|
] as const;
|
||||||
|
|
||||||
export const DEFAULT_LOCALE = SUPPORTED_LOCALES[0];
|
export const DEFAULT_LOCALE = SUPPORTED_LOCALES[0];
|
||||||
export const LOCALE_FILES: Record<(typeof SUPPORTED_LOCALES)[number], string> =
|
|
||||||
{
|
export type SupportedLocale = (typeof SUPPORTED_LOCALES)[number];
|
||||||
en: 'en-US',
|
|
||||||
es: 'es-ES',
|
|
||||||
hr: 'hr',
|
|
||||||
ru: 'ru',
|
|
||||||
uk: 'uk',
|
|
||||||
cn: 'zh-CN',
|
|
||||||
};
|
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
---
|
---
|
||||||
import { assertSecret, SUPPORTED_LOCALES } from '@blitzkit/core';
|
import {
|
||||||
import { Box, Flex, Heading } from '@radix-ui/themes';
|
assertSecret,
|
||||||
|
DEFAULT_LOCALE,
|
||||||
|
SUPPORTED_LOCALES,
|
||||||
|
} from '@blitzkit/core';
|
||||||
|
import strings from '@blitzkit/core/lang/en.json';
|
||||||
|
import { Box, Flex, Heading, Link, Text } from '@radix-ui/themes';
|
||||||
import type { GetStaticPaths } from 'astro';
|
import type { GetStaticPaths } from 'astro';
|
||||||
import { AesonPlug } from '../../components/AesonPlug';
|
import { AesonPlug } from '../../components/AesonPlug';
|
||||||
import HomeHero from '../../components/HomeHero.astro';
|
import HomeHero from '../../components/HomeHero.astro';
|
||||||
@@ -34,6 +39,30 @@ export const getStaticPaths = (() => {
|
|||||||
<BaseLayout>
|
<BaseLayout>
|
||||||
<HomeHero />
|
<HomeHero />
|
||||||
|
|
||||||
|
<Flex justify="center" gap="2" pt="6" pb="4">
|
||||||
|
{
|
||||||
|
SUPPORTED_LOCALES.map((thisLocale, index) => {
|
||||||
|
const selected =
|
||||||
|
thisLocale === locale ||
|
||||||
|
(locale === undefined && thisLocale === DEFAULT_LOCALE);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{index > 0 && <Text color="gray">|</Text>}
|
||||||
|
|
||||||
|
<Link
|
||||||
|
color="gray"
|
||||||
|
highContrast={selected}
|
||||||
|
href={`/${thisLocale === DEFAULT_LOCALE ? '' : thisLocale}`}
|
||||||
|
>
|
||||||
|
{strings.common.locales[thisLocale]}
|
||||||
|
</Link>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Flex>
|
||||||
|
|
||||||
<Plugs client:idle />
|
<Plugs client:idle />
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user