From 6233c16b881f579ada45dc67b01ab0914617d0cd Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Tue, 14 Jan 2025 20:19:37 -0600 Subject: [PATCH] feat: fixed localize tankopedia chars --- .../src/blitzkit/tankDefinitions/constants.ts | 17 ++-------------- packages/i18n/strings/en.json | 9 ++++++++- .../components/Characteristics/index.tsx | 3 +-- .../website/src/pages/[...locale]/index.astro | 20 ++++++++++++++++++- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/packages/core/src/blitzkit/tankDefinitions/constants.ts b/packages/core/src/blitzkit/tankDefinitions/constants.ts index efa2e7e16..d2d70b602 100644 --- a/packages/core/src/blitzkit/tankDefinitions/constants.ts +++ b/packages/core/src/blitzkit/tankDefinitions/constants.ts @@ -1,11 +1,5 @@ import { times } from 'lodash-es'; -import { - CrewType, - GunDefinition, - ShellType, - TankClass, - TankType, -} from '../../protos'; +import { CrewType, ShellType, TankClass, TankType } from '../../protos'; export const SHELL_NAMES: Record = { [ShellType.AP]: 'AP', @@ -20,14 +14,7 @@ export const CREW_MEMBER_NAMES = { [CrewType.LOADER]: 'loader', [CrewType.RADIOMAN]: 'radioman', } as const; -export const GUN_TYPE_NAMES: Record< - Exclude['$case'], - string -> = { - auto_loader: 'Auto loader', - auto_reloader: 'Auto reloader', - regular: 'Regular', -}; + /** * @deprecated use svg */ diff --git a/packages/i18n/strings/en.json b/packages/i18n/strings/en.json index cc45bd9a9..83e56c1f9 100644 --- a/packages/i18n/strings/en.json +++ b/packages/i18n/strings/en.json @@ -14,6 +14,12 @@ "x": "x%s1" }, + "gun_types": { + "auto_loader": "Auto loader", + "auto_reloader": "Auto reloader", + "regular": "Regular" + }, + "shells": { "ap": "AP", "apcr": "APCR", @@ -817,7 +823,8 @@ }, "other_projects": { "title": "Other cool projects" - } + }, + "help_translate": "Please help translate %s1 to %s2!" }, "tools": { diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx index 8dea59793..173cc2120 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx @@ -3,7 +3,6 @@ import { coefficient, CREW_MEMBER_NAMES, CrewType, - GUN_TYPE_NAMES, isExplosive, resolvePenetrationCoefficient, } from '@blitzkit/core'; @@ -192,7 +191,7 @@ export function Characteristics() { strings.website.tools.tankopedia.characteristics.values.gunType } > - {GUN_TYPE_NAMES[gun.gun_type!.$case]} + {strings.common.gun_types[gun.gun_type!.$case]} { + { + locale !== DEFAULT_LOCALE && ( + + + {literals(strings.website.home.help_translate, [ + 'BlitzKit', + strings.common.locales[locale], + ])} + + + ) + } + {