mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
feat: localize
This commit is contained in:
1 parent
55ffe22fd6
commit
b2856eab58
2 files changed
+30
-15
No files matched your search
@@ -15,7 +15,8 @@
|
|||||||
"hp": "{value}hp",
|
"hp": "{value}hp",
|
||||||
"x": "x{value}",
|
"x": "x{value}",
|
||||||
"percentage": "{value}%",
|
"percentage": "{value}%",
|
||||||
"deg_s": "{value}°/s"
|
"deg_s": "{value}°/s",
|
||||||
|
"plus": "+{value}"
|
||||||
},
|
},
|
||||||
|
|
||||||
"gun_types": {
|
"gun_types": {
|
||||||
@@ -759,6 +760,8 @@
|
|||||||
"count_singular": "1 tank",
|
"count_singular": "1 tank",
|
||||||
"count_plural": "{count} tanks",
|
"count_plural": "{count} tanks",
|
||||||
"sorting_by": "Sorting by {name}",
|
"sorting_by": "Sorting by {name}",
|
||||||
|
"clear": "Clear",
|
||||||
|
"tier": "Tier {tier}",
|
||||||
|
|
||||||
"no_tanks_found": {
|
"no_tanks_found": {
|
||||||
"body": "No tanks found.",
|
"body": "No tanks found.",
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
TankType,
|
TankType,
|
||||||
TIER_ROMAN_NUMERALS,
|
TIER_ROMAN_NUMERALS,
|
||||||
} from "@blitzkit/core";
|
} from "@blitzkit/core";
|
||||||
|
import { literals } from "@blitzkit/i18n";
|
||||||
import locales from "@blitzkit/i18n/locales.json";
|
import locales from "@blitzkit/i18n/locales.json";
|
||||||
import {
|
import {
|
||||||
LockClosedIcon,
|
LockClosedIcon,
|
||||||
@@ -96,7 +97,7 @@ const TIERS = times(10, (i) => 10 - i);
|
|||||||
|
|
||||||
export function FilterControl() {
|
export function FilterControl() {
|
||||||
return (
|
return (
|
||||||
<Flex align="center" gap="2" wrap="wrap">
|
<Flex align="center" gap="2" wrap="wrap" justify="center">
|
||||||
<TiersFilter />
|
<TiersFilter />
|
||||||
<NationsFilter />
|
<NationsFilter />
|
||||||
<TypeFilter />
|
<TypeFilter />
|
||||||
@@ -114,6 +115,7 @@ export function FilterControl() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function TiersFilter() {
|
function TiersFilter() {
|
||||||
|
const { strings } = useLocale();
|
||||||
const tiersRaw = TankFilters.use((state) => state.tiers);
|
const tiersRaw = TankFilters.use((state) => state.tiers);
|
||||||
const tiers = tiersRaw.length === 0 ? TIERS : tiersRaw;
|
const tiers = tiersRaw.length === 0 ? TIERS : tiersRaw;
|
||||||
|
|
||||||
@@ -129,7 +131,11 @@ function TiersFilter() {
|
|||||||
))}
|
))}
|
||||||
|
|
||||||
{tiers.length > MAX_TIERS && (
|
{tiers.length > MAX_TIERS && (
|
||||||
<Text size="1">+{tiers.length - MAX_TIERS}</Text>
|
<Text size="1">
|
||||||
|
{literals(strings.common.units.plus, {
|
||||||
|
value: tiers.length - MAX_TIERS,
|
||||||
|
})}
|
||||||
|
</Text>
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
</Button>
|
</Button>
|
||||||
@@ -155,7 +161,9 @@ function TiersFilter() {
|
|||||||
checked={selected}
|
checked={selected}
|
||||||
key={tier}
|
key={tier}
|
||||||
>
|
>
|
||||||
Tier {TIER_ROMAN_NUMERALS[tier]}
|
{literals(strings.website.common.tank_search.tier, {
|
||||||
|
tier: TIER_ROMAN_NUMERALS[tier],
|
||||||
|
})}
|
||||||
</DropdownMenu.CheckboxItem>
|
</DropdownMenu.CheckboxItem>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -173,7 +181,7 @@ function TiersFilter() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TrashIcon />
|
<TrashIcon />
|
||||||
Clear
|
{strings.website.common.tank_search.clear}
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
</DropdownMenu.Content>
|
</DropdownMenu.Content>
|
||||||
</DropdownMenu.Root>
|
</DropdownMenu.Root>
|
||||||
@@ -277,7 +285,7 @@ function NationsFilter() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TrashIcon />
|
<TrashIcon />
|
||||||
Clear
|
{strings.website.common.tank_search.clear}
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
</DropdownMenu.Content>
|
</DropdownMenu.Content>
|
||||||
</DropdownMenu.Root>
|
</DropdownMenu.Root>
|
||||||
@@ -357,7 +365,7 @@ function ClassFilter() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TrashIcon />
|
<TrashIcon />
|
||||||
Clear
|
{strings.website.common.tank_search.clear}
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
</DropdownMenu.Content>
|
</DropdownMenu.Content>
|
||||||
</DropdownMenu.Root>
|
</DropdownMenu.Root>
|
||||||
@@ -435,7 +443,7 @@ function GunTypeFilter() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TrashIcon />
|
<TrashIcon />
|
||||||
Clear
|
{strings.website.common.tank_search.clear}
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
</DropdownMenu.Content>
|
</DropdownMenu.Content>
|
||||||
</DropdownMenu.Root>
|
</DropdownMenu.Root>
|
||||||
@@ -521,7 +529,7 @@ function TypeFilter() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TrashIcon />
|
<TrashIcon />
|
||||||
Clear
|
{strings.website.common.tank_search.clear}
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
</DropdownMenu.Content>
|
</DropdownMenu.Content>
|
||||||
</DropdownMenu.Root>
|
</DropdownMenu.Root>
|
||||||
@@ -737,10 +745,10 @@ function TestFilter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ConsumablesFilter() {
|
function ConsumablesFilter() {
|
||||||
|
const { unwrap, strings } = useLocale();
|
||||||
const rawConsumables = TankFilters.use((state) => state.consumables);
|
const rawConsumables = TankFilters.use((state) => state.consumables);
|
||||||
const consumables =
|
const consumables =
|
||||||
rawConsumables.length === 0 ? consumablesArray : rawConsumables;
|
rawConsumables.length === 0 ? consumablesArray : rawConsumables;
|
||||||
const { unwrap } = useLocale();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenu.Root>
|
<DropdownMenu.Root>
|
||||||
@@ -762,7 +770,9 @@ function ConsumablesFilter() {
|
|||||||
|
|
||||||
{consumables.length > MAX_CONSUMABLES && (
|
{consumables.length > MAX_CONSUMABLES && (
|
||||||
<Text size="1" ml="1">
|
<Text size="1" ml="1">
|
||||||
+{consumables.length - MAX_CONSUMABLES}
|
{literals(strings.common.units.plus, {
|
||||||
|
value: consumables.length - MAX_CONSUMABLES,
|
||||||
|
})}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
@@ -820,7 +830,7 @@ function ConsumablesFilter() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TrashIcon />
|
<TrashIcon />
|
||||||
Clear
|
{strings.website.common.tank_search.clear}
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
</DropdownMenu.Content>
|
</DropdownMenu.Content>
|
||||||
</DropdownMenu.Root>
|
</DropdownMenu.Root>
|
||||||
@@ -828,9 +838,9 @@ function ConsumablesFilter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function AbilitiesFilter() {
|
function AbilitiesFilter() {
|
||||||
|
const { unwrap, strings } = useLocale();
|
||||||
const rawAbilities = TankFilters.use((state) => state.abilities);
|
const rawAbilities = TankFilters.use((state) => state.abilities);
|
||||||
const abilities = rawAbilities.length === 0 ? abilitiesArray : rawAbilities;
|
const abilities = rawAbilities.length === 0 ? abilitiesArray : rawAbilities;
|
||||||
const { unwrap } = useLocale();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenu.Root>
|
<DropdownMenu.Root>
|
||||||
@@ -852,7 +862,9 @@ function AbilitiesFilter() {
|
|||||||
|
|
||||||
{abilities.length > MAX_ABILITIES && (
|
{abilities.length > MAX_ABILITIES && (
|
||||||
<Text size="1" ml="1">
|
<Text size="1" ml="1">
|
||||||
+{abilities.length - MAX_ABILITIES}
|
{literals(strings.common.units.plus, {
|
||||||
|
value: abilities.length - MAX_ABILITIES,
|
||||||
|
})}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
@@ -909,7 +921,7 @@ function AbilitiesFilter() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TrashIcon />
|
<TrashIcon />
|
||||||
Clear
|
{strings.website.common.tank_search.clear}
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
</DropdownMenu.Content>
|
</DropdownMenu.Content>
|
||||||
</DropdownMenu.Root>
|
</DropdownMenu.Root>
|
||||||
|
|||||||
Reference in new issue
Block a user