diff --git a/packages/core/lang/en.json b/packages/core/lang/en.json index 89b602b97..90eaece70 100644 --- a/packages/core/lang/en.json +++ b/packages/core/lang/en.json @@ -731,6 +731,11 @@ "count_singular": "1 tank", "count_plural": "%s1 tanks", "sorting_by": "Sorting by %s1", + "no_tanks_found": { + "body": "No tanks found.", + "search_again": "Try searching again.", + "clear_filters": "Try clearing filters." + }, "sort": { "meta.none": "none", "survivability.health": "health", diff --git a/packages/website/src/components/LinkI18n.tsx b/packages/website/src/components/LinkI18n.tsx index 4252fed1d..18f8f6a2e 100644 --- a/packages/website/src/components/LinkI18n.tsx +++ b/packages/website/src/components/LinkI18n.tsx @@ -1,10 +1,12 @@ +import { DEFAULT_LOCALE } from '@blitzkit/core'; import { Link, type LinkProps } from '@radix-ui/themes'; import type { LocaleAcceptorProps } from '../hooks/useLocale'; type LinkI18nProps = LinkProps & LocaleAcceptorProps; export function LinkI18n({ locale, href, ...props }: LinkI18nProps) { - const prefix = locale === undefined ? '' : `/${locale}`; + const prefix = + locale === undefined || locale === DEFAULT_LOCALE ? '' : `/${locale}`; return ( diff --git a/packages/website/src/components/TankSearch/components/NoResults.tsx b/packages/website/src/components/TankSearch/components/NoResults.tsx index 78694928a..979445012 100644 --- a/packages/website/src/components/TankSearch/components/NoResults.tsx +++ b/packages/website/src/components/TankSearch/components/NoResults.tsx @@ -1,4 +1,5 @@ import { Flex, Link, Text } from '@radix-ui/themes'; +import { useLocale } from '../../../hooks/useLocale'; import { $tankFilters, initialTankFilters } from '../../../stores/tankFilters'; interface NoResultsProps { @@ -6,10 +7,12 @@ interface NoResultsProps { } export function NoResults({ type = 'filters' }: NoResultsProps) { + const { strings } = useLocale(); + return ( - No tanks found.{' '} + {strings.website.common.tank_search.no_tanks_found.body}.{' '} - {type === 'filters' ? 'Try clearing filters' : 'Try searching again'} + {type === 'filters' + ? strings.website.common.tank_search.no_tanks_found.clear_filters + : strings.website.common.tank_search.no_tanks_found.search_again} . diff --git a/packages/website/src/components/TankSearch/components/RecentlyViewed.tsx b/packages/website/src/components/TankSearch/components/RecentlyViewed.tsx index 9336ba951..cb87544ee 100644 --- a/packages/website/src/components/TankSearch/components/RecentlyViewed.tsx +++ b/packages/website/src/components/TankSearch/components/RecentlyViewed.tsx @@ -3,6 +3,7 @@ import { Flex, Separator, Text } from '@radix-ui/themes'; import { isEqual } from 'lodash-es'; import { useMemo } from 'react'; import { awaitableTankDefinitions } from '../../../core/awaitables/tankDefinitions'; +import { useLocale } from '../../../hooks/useLocale'; import { $tankFilters, initialTankFilters } from '../../../stores/tankFilters'; import { TankopediaPersistent } from '../../../stores/tankopediaPersistent'; import { $tankopediaSort } from '../../../stores/tankopediaSort'; @@ -27,6 +28,7 @@ export function RecentlyViewed() { }), [filters], ); + const { strings } = useLocale(); if (recentlyViewed.length === 0 || sort.by !== 'meta.none' || hasFilters) { return null; @@ -35,7 +37,7 @@ export function RecentlyViewed() { return ( - Recently viewed + {strings.website.common.tank_search.recent} {recentlyViewed.map((id) => ( diff --git a/packages/website/src/layouts/BaseLayout.astro b/packages/website/src/layouts/BaseLayout.astro index 8228acb92..a6344f7cc 100644 --- a/packages/website/src/layouts/BaseLayout.astro +++ b/packages/website/src/layouts/BaseLayout.astro @@ -6,18 +6,19 @@ 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/core'; export interface Props { noFooter?: boolean; } const { noFooter } = Astro.props; -const { locale } = Astro.params; +const locale = Astro.params.locale ?? DEFAULT_LOCALE; const { pathname } = Astro.url; const isRoot = pathname === '/'; --- - + { isRoot && (