feat: simplification

This commit is contained in:
tresabhi committed 2024-12-29 20:19:51 -06:00
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';
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(
LOCALE_FILES,
) as Locale[];
DISCORD_SUPPORTED_LOCALES,
);
+10
View File
@@ -1,5 +1,15 @@
{
"common": {
"locales": {
"en": "English",
"es": "Spanish",
"hr": "Croatian",
"pt": "Portuguese",
"ru": "Russian",
"uk": "Ukrainian",
"zh": "Chinese"
},
"wn8_percentile": {
"0": "Very bad",
"1": "Bad",
+12 -10
View File
@@ -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 LOCALE_FILES: Record<(typeof SUPPORTED_LOCALES)[number], string> =
{
en: 'en-US',
es: 'es-ES',
hr: 'hr',
ru: 'ru',
uk: 'uk',
cn: 'zh-CN',
};
export type SupportedLocale = (typeof SUPPORTED_LOCALES)[number];
@@ -1,6 +1,11 @@
---
import { assertSecret, SUPPORTED_LOCALES } from '@blitzkit/core';
import { Box, Flex, Heading } from '@radix-ui/themes';
import {
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 { AesonPlug } from '../../components/AesonPlug';
import HomeHero from '../../components/HomeHero.astro';
@@ -34,6 +39,30 @@ export const getStaticPaths = (() => {
<BaseLayout>
<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 />
{