From 2c365cdea06e2fc4c94a207084b35ccdaaed4e8a Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Tue, 14 Jan 2025 19:37:03 -0600 Subject: [PATCH] feat: localize tankopedia config --- packages/i18n/strings/en.json | 32 +++++++++++++++++++ .../components/Consumables.tsx | 14 +++++--- .../components/Equipment.tsx | 8 +++-- .../components/Miscellaneous.tsx | 6 +++- .../components/Modules.tsx | 9 ++++-- .../components/Provisions.tsx | 8 +++-- .../components/Skills.tsx | 18 +++++------ .../CharacteristicsSection/index.tsx | 7 +++- 8 files changed, 79 insertions(+), 23 deletions(-) diff --git a/packages/i18n/strings/en.json b/packages/i18n/strings/en.json index 3e0f39fe2..0fa6ed9d1 100644 --- a/packages/i18n/strings/en.json +++ b/packages/i18n/strings/en.json @@ -941,6 +941,38 @@ "title": "Review videos", "disclaimer": "BlitzKit does not endorse any review videos.", "join": "Apply to %s1 YouTuber program" + }, + + "configuration": { + "title": "Configuration", + + "modules": { + "title": "Modules", + "stock": "Stock", + "upgrade": "Upgrade" + }, + "equipment": { + "title": "Equipment", + "clear": "Clear" + }, + "provisions": { + "title": "Provisions", + "clear": "Clear" + }, + "consumables": { + "title": "Consumables", + "clear": "Clear", + "info": "Yellow consumables do not affect the statistics." + }, + "skills": { + "title": "Crew skills", + "clear": "Clear", + "maximize": "Maximize", + "info": "Yellow skills only apply under special circumstances. Hold Space to quickly toggle between level 0 and 7." + }, + "miscellaneous": { + "title": "Miscellaneous" + } } }, "compare": { diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Consumables.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Consumables.tsx index 88c9c9daa..0eac29077 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Consumables.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Consumables.tsx @@ -10,6 +10,7 @@ import { } from '@radix-ui/themes'; import { awaitableConsumableDefinitions } from '../../../../core/awaitables/consumableDefinitions'; import { useEquipment } from '../../../../hooks/useEquipment'; +import { useLocale } from '../../../../hooks/useLocale'; import { Duel } from '../../../../stores/duel'; import { ConsumablesManager } from '../../../ConsumablesManager'; import { ConfigurationChildWrapper } from './ConfigurationChildWrapper'; @@ -34,12 +35,15 @@ export function Consumables() { ); const hasConsumableDeliverySystem = useEquipment(118); const hasHighEndConsumables = useEquipment(101); + const { strings } = useLocale(); return ( - Consumables + + {strings.website.tools.tankopedia.configuration.consumables.title} + @@ -50,8 +54,10 @@ export function Consumables() { - Yellow consumables do not affect the - statistics. + { + strings.website.tools.tankopedia.configuration.consumables + .info + } @@ -66,7 +72,7 @@ export function Consumables() { }); }} > - Clear + {strings.website.tools.tankopedia.configuration.consumables.clear} diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Equipment.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Equipment.tsx index 63cc3bc88..67e35f4f1 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Equipment.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Equipment.tsx @@ -1,5 +1,6 @@ import { Button, Flex, Heading } from '@radix-ui/themes'; import { awaitableEquipmentDefinitions } from '../../../../core/awaitables/equipmentDefinitions'; +import { useLocale } from '../../../../hooks/useLocale'; import { Duel } from '../../../../stores/duel'; import { EquipmentManager } from '../../../EquipmentManager'; import { ConfigurationChildWrapper } from './ConfigurationChildWrapper'; @@ -14,11 +15,14 @@ export function Equipment() { const equipmentMatrix = Duel.use( (state) => state.protagonist.equipmentMatrix, ); + const { strings } = useLocale(); return ( - Equipment + + {strings.website.tools.tankopedia.configuration.equipment.title} + diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Miscellaneous.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Miscellaneous.tsx index 90752ced1..0627c6a4b 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Miscellaneous.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Miscellaneous.tsx @@ -1,5 +1,6 @@ import { asset } from '@blitzkit/core'; import { Flex, Heading } from '@radix-ui/themes'; +import { useLocale } from '../../../../hooks/useLocale'; import { Duel } from '../../../../stores/duel'; import { GenericTankComponentButton } from '../../../ModuleButtons/GenericTankComponentButton'; import { ConfigurationChildWrapper } from './ConfigurationChildWrapper'; @@ -11,10 +12,13 @@ export function Miscellaneous() { (state) => state.protagonist.cooldownBooster, ); const { tank } = Duel.use((state) => state.protagonist); + const { strings } = useLocale(); return ( - Miscellaneous + + {strings.website.tools.tankopedia.configuration.miscellaneous.title} + {!tank.fixed_camouflage && ( diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Modules.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Modules.tsx index b7fa23593..14949404d 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Modules.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Modules.tsx @@ -165,6 +165,7 @@ export function Modules() { const topGun = topTurret.guns.at(-1)!; const topEngine = tank.engines.at(-1)!; const topTrack = tank.tracks.at(-1)!; + const { strings } = useLocale(); function setByUnlock(unlock: Unlock) { mutateDuel((draft) => { @@ -354,7 +355,9 @@ export function Modules() { return ( - Modules + + {strings.website.tools.tankopedia.configuration.modules.title} + {hasUpgrades && ( <> @@ -372,7 +375,7 @@ export function Modules() { }); }} > - Stock + {strings.website.tools.tankopedia.configuration.modules.stock} )} diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Provisions.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Provisions.tsx index 62ffc1b3d..88179bcb4 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Provisions.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Provisions.tsx @@ -1,6 +1,7 @@ import { availableProvisions } from '@blitzkit/core'; import { Button, Flex, Heading } from '@radix-ui/themes'; import { awaitableProvisionDefinitions } from '../../../../core/awaitables/provisionDefinitions'; +import { useLocale } from '../../../../hooks/useLocale'; import { Duel } from '../../../../stores/duel'; import { ProvisionsManager } from '../../../ProvisionsManager'; import { ConfigurationChildWrapper } from './ConfigurationChildWrapper'; @@ -12,11 +13,14 @@ export function Provisions() { const { tank, gun } = Duel.use((state) => state.protagonist); const provisions = Duel.use((state) => state.protagonist.provisions); const provisionsList = availableProvisions(tank, gun, provisionDefinitions); + const { strings } = useLocale(); return ( - Provisions + + {strings.website.tools.tankopedia.configuration.provisions.title} + diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Skills.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Skills.tsx index 097af9218..45f488ecf 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Skills.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Skills.tsx @@ -4,10 +4,10 @@ import { Flex, Heading, IconButton, - Kbd, Popover, Text, } from '@radix-ui/themes'; +import { useLocale } from '../../../../hooks/useLocale'; import { TankopediaEphemeral } from '../../../../stores/tankopediaEphemeral'; import { CrewSkillManager } from '../../../CrewSkillManager'; import { ConfigurationChildWrapper } from './ConfigurationChildWrapper'; @@ -15,12 +15,15 @@ import { ConfigurationChildWrapper } from './ConfigurationChildWrapper'; export function Skills() { const skillLevels = TankopediaEphemeral.use((state) => state.skills); const mutateTankopediaTemporary = TankopediaEphemeral.useMutation(); + const { strings } = useLocale(); return ( - Crew skills + + {strings.website.tools.tankopedia.configuration.skills.title} + @@ -32,12 +35,7 @@ export function Skills() { - Yellow skills only apply under - special circumstances. - - - - Hold Shift to quickly toggle between level 0 and 7. + {strings.website.tools.tankopedia.configuration.skills.info} @@ -55,7 +53,7 @@ export function Skills() { }); }} > - Clear + {strings.website.tools.tankopedia.configuration.skills.clear} diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/index.tsx index 9cab5255f..840f4c1c4 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/index.tsx @@ -1,4 +1,5 @@ import { Flex, Heading } from '@radix-ui/themes'; +import { useLocale } from '../../../hooks/useLocale'; import { Characteristics } from './components/Characteristics'; import { CharacteristicsHeading } from './components/Characteristics/components/Heading'; import { Consumables } from './components/Consumables'; @@ -9,6 +10,8 @@ import { Provisions } from './components/Provisions'; import { Skills } from './components/Skills'; export function CharacteristicsSection() { + const { strings } = useLocale(); + return ( - Configuration + + {strings.website.tools.tankopedia.configuration.title} +