From 571ae81306caae6cdaf5f7f36a49f4cc3d31cc3e Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Tue, 7 Jan 2025 13:09:05 -0600 Subject: [PATCH] feat: translate tier list --- .github/workflows/website.yml | 4 ++-- packages/core/lang/en.json | 12 +++++++++++- packages/website/src/components/CopyButton.tsx | 7 ++++++- .../TierList/Controls/components/Share.tsx | 4 +++- .../src/components/TierList/Controls/index.tsx | 4 +++- .../[...locale]/tools/tier-list/_index.tsx | 18 ++++++++++++------ .../[...locale]/tools/tier-list/index.astro | 4 +++- 7 files changed, 40 insertions(+), 13 deletions(-) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index b6543fb1f..5f25dd8e3 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -2,6 +2,8 @@ name: Website on: push: + branches: + - main workflow_dispatch: schedule: @@ -52,8 +54,6 @@ jobs: path: dist/website deploy-github-pages: - if: github.ref == 'refs/heads/main' - name: Deploy to GitHub Pages runs-on: ubuntu-latest needs: build diff --git a/packages/core/lang/en.json b/packages/core/lang/en.json index f11f17e61..e3b74f683 100644 --- a/packages/core/lang/en.json +++ b/packages/core/lang/en.json @@ -713,6 +713,12 @@ }, "website": { + "common": { + "copy_button": { + "copied": "Copied!" + } + }, + "home": { "hero": { "credit": "By %s1 ❤️" @@ -795,7 +801,11 @@ "name": "Tier list", "button": "Rank tanks", "description": "Rank Blitz tanks", - "seo_description": "Explore tier lists ranking tanks from best to worst, based on player ratings and statistical performance in World of Tanks Blitz" + "seo_description": "Explore tier lists ranking tanks from best to worst, based on player ratings and statistical performance in World of Tanks Blitz", + "buttons": { + "reset": "Reset", + "share": "Share" + } }, "embed": { "name": "Embed", diff --git a/packages/website/src/components/CopyButton.tsx b/packages/website/src/components/CopyButton.tsx index 1365316ca..8fa174242 100644 --- a/packages/website/src/components/CopyButton.tsx +++ b/packages/website/src/components/CopyButton.tsx @@ -1,5 +1,6 @@ import { Button, type ButtonProps, Tooltip } from '@radix-ui/themes'; import { useState } from 'react'; +import { useLocale } from '../hooks/useLocale'; interface CopyButtonProps extends ButtonProps { copy: () => string | undefined; @@ -7,9 +8,13 @@ interface CopyButtonProps extends ButtonProps { export function CopyButton({ copy, ...props }: CopyButtonProps) { const [tooltipOpen, setTooltipOpen] = useState(false); + const { strings } = useLocale(); return ( - + diff --git a/packages/website/src/pages/[...locale]/tools/tier-list/_index.tsx b/packages/website/src/pages/[...locale]/tools/tier-list/_index.tsx index a9fce97ef..c068da096 100644 --- a/packages/website/src/pages/[...locale]/tools/tier-list/_index.tsx +++ b/packages/website/src/pages/[...locale]/tools/tier-list/_index.tsx @@ -4,16 +4,22 @@ import { TierListControls } from '../../../../components/TierList/Controls'; import { TierListTable } from '../../../../components/TierList/Table'; import { TierListTiles } from '../../../../components/TierList/Tiles'; import { URLManager } from '../../../../components/TierList/URLManager'; +import { + LocaleProvider, + type LocaleAcceptorProps, +} from '../../../../hooks/useLocale'; import { TankopediaPersistent } from '../../../../stores/tankopediaPersistent'; import { TierList } from '../../../../stores/tierList'; -export function Page() { +export function Page({ locale }: LocaleAcceptorProps) { return ( - - - - - + + + + + + + ); } diff --git a/packages/website/src/pages/[...locale]/tools/tier-list/index.astro b/packages/website/src/pages/[...locale]/tools/tier-list/index.astro index fd889bcc8..e22b87824 100644 --- a/packages/website/src/pages/[...locale]/tools/tier-list/index.astro +++ b/packages/website/src/pages/[...locale]/tools/tier-list/index.astro @@ -4,8 +4,10 @@ import ToolLayout from '../../../../layouts/ToolLayout.astro'; import { Page } from './_index'; export { getStaticPaths } from '../../index.astro'; + +const { locale } = Astro.params; --- - +