diff --git a/packages/i18n/strings/en.json b/packages/i18n/strings/en.json
index b742389ee..229ad0993 100644
--- a/packages/i18n/strings/en.json
+++ b/packages/i18n/strings/en.json
@@ -824,7 +824,8 @@
"other_projects": {
"title": "Other cool projects"
},
- "help_translate": "Please help translate %s1 to %s2!"
+ "help_translate": "Please help translate %s1 to %s2!",
+ "seo_description": "Tools for everything World of Tanks Blitz"
},
"tools": {
diff --git a/packages/website/src/components/Footer.astro b/packages/website/src/components/Footer.astro
index f57fdba2c..77c7dc7a6 100644
--- a/packages/website/src/components/Footer.astro
+++ b/packages/website/src/components/Footer.astro
@@ -1,12 +1,14 @@
---
import { assertSecret, fetchGameDefinitions } from '@blitzkit/core';
-import { Code, Flex, Heading, Link, Text } from '@radix-ui/themes';
+import { DEFAULT_LOCALE } from '@blitzkit/i18n';
+import { Box, Code, Flex, Heading, Link, Text } from '@radix-ui/themes';
import packageJson from '../../../../package.json';
import { getStrings } from '../core/i18n/getStrings';
+import { LocaleSwitcherThemeWrapper } from './LocaleSwitcher';
const gameDefinitions = await fetchGameDefinitions();
const PUBLIC_ASSET_BRANCH = assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH);
-const { locale } = Astro.params;
+const locale = Astro.params.locale ?? DEFAULT_LOCALE;
const strings = getStrings(locale);
---
@@ -39,6 +41,10 @@ const strings = getStrings(locale);
{strings.website.footer.copyright}
+
+
+
+
+
+
+ );
+}
export function LocaleSwitcher({ locale }: LocaleAcceptorProps) {
return (
@@ -14,7 +23,19 @@ export function LocaleSwitcher({ locale }: LocaleAcceptorProps) {
defaultValue={locale}
onValueChange={(locale) => {
localStorage.setItem('preferred-locale', locale);
- window.location.pathname = `/${locale === DEFAULT_LOCALE ? '' : locale}`;
+
+ let rawPath = window.location.pathname;
+
+ for (const supportedLocale of SUPPORTED_LOCALES) {
+ if (window.location.pathname.startsWith(`/${supportedLocale}`)) {
+ rawPath = rawPath.replace(`/${supportedLocale}`, '');
+ break;
+ }
+ }
+
+ window.location.pathname = `${
+ locale === DEFAULT_LOCALE ? '' : `/${locale}`
+ }${rawPath}`;
}}
>
diff --git a/packages/website/src/layouts/BaseLayout.astro b/packages/website/src/layouts/BaseLayout.astro
index ce10f8f0f..efe83e9b7 100644
--- a/packages/website/src/layouts/BaseLayout.astro
+++ b/packages/website/src/layouts/BaseLayout.astro
@@ -6,7 +6,7 @@ import Footer from '../components/Footer.astro';
import Navbar from '../components/Navbar.astro';
import Party3 from '../components/Party3.astro';
import './base.css';
-import { DEFAULT_LOCALE } from '@blitzkit/i18n';
+import { DEFAULT_LOCALE, SUPPORTED_LOCALES } from '@blitzkit/i18n';
export interface Props {
noFooter?: boolean;
@@ -14,23 +14,10 @@ export interface Props {
const { noFooter } = Astro.props;
const locale = Astro.params.locale ?? DEFAULT_LOCALE;
-const { pathname } = Astro.url;
-const isRoot = pathname === '/';
---
- {
- isRoot && (
- <>
- BlitzKit
-
- >
- )
- }
@@ -41,7 +28,7 @@ const isRoot = pathname === '/';