From 434d1ede3c5cce29526f8133ec127b3b4e0ea844 Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Fri, 31 Jul 2026 11:21:50 -0500 Subject: [PATCH] use transliteration --- bun.lock | 3 +++ packages/scripts/src/buildAssets/constants.ts | 2 +- packages/scripts/src/buildAssets/definitions.ts | 13 ++----------- packages/website/package.json | 1 + 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/bun.lock b/bun.lock index 5db46834c..fe8a7edec 100644 --- a/bun.lock +++ b/bun.lock @@ -173,6 +173,7 @@ "react-promise-suspense": "^0.3.4", "three": "^0.180.0", "three-stdlib": "^2.36.0", + "transliteration": "^2.6.1", "typescript": "^5.9.3", "urlon": "^3.1.0", "varuna": "workspace:*", @@ -2427,6 +2428,8 @@ "tr46": ["tr46@1.0.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA=="], + "transliteration": ["transliteration@2.6.1", "", { "bin": { "transliterate": "dist/bin/transliterate", "slugify": "dist/bin/slugify" } }, "sha512-hJ9BhrQAOnNTbpOr1MxsNjZISkn7ppvF5TKUeFmTE1mG4ZPD/XVxF0L0LUoIUCWmQyxH0gJpVtfYLAWf298U9w=="], + "trim-lines": ["trim-lines@3.0.1", "", {}, "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg=="], "troika-three-text": ["troika-three-text@0.52.4", "", { "dependencies": { "bidi-js": "^1.0.2", "troika-three-utils": "^0.52.4", "troika-worker-utils": "^0.52.0", "webgl-sdf-generator": "1.1.1" }, "peerDependencies": { "three": ">=0.125.0" } }, "sha512-V50EwcYGruV5rUZ9F4aNsrytGdKcXKALjEtQXIOBfhVoZU9VAqZNIoGQ3TMiooVqFAbR1w15T+f+8gkzoFzawg=="], diff --git a/packages/scripts/src/buildAssets/constants.ts b/packages/scripts/src/buildAssets/constants.ts index e6c37836e..d295c7ad6 100644 --- a/packages/scripts/src/buildAssets/constants.ts +++ b/packages/scripts/src/buildAssets/constants.ts @@ -1,9 +1,9 @@ import { assertSecret } from "@blitzkit/core"; import { AbstractVFS } from "../core/vfs/abstract"; import { LocalVFS } from "../core/vfs/local"; +import { MixedVFS } from "../core/vfs/mixed"; import { SteamVFS } from "../core/vfs/steam"; import { ZipVFS } from "../core/vfs/zip"; -import { MixedVFS } from "../core/vfs/mixed"; export const PATCHES_ROOT = "../../temp/patches"; diff --git a/packages/scripts/src/buildAssets/definitions.ts b/packages/scripts/src/buildAssets/definitions.ts index 467a99b85..f7c1afa3a 100644 --- a/packages/scripts/src/buildAssets/definitions.ts +++ b/packages/scripts/src/buildAssets/definitions.ts @@ -34,20 +34,15 @@ import { import { SUPPORTED_LOCALE_BLITZ_MAP } from "@blitzkit/i18n"; import locales from "@blitzkit/i18n/locales.json"; import { readFile } from "fs/promises"; -import { deburr } from "lodash-es"; import { parse as parsePath } from "path"; import type { Vector3Tuple } from "three"; +import { slugify } from "transliteration"; import { parse as parseYaml } from "yaml"; import { AssetUploader } from "../core/github/assetUploader"; import { vfs } from "./constants"; import type { Avatar } from "./skillIcons"; import type { TankParameters } from "./tankIcons"; -const nonAlphanumericRegex = /[^a-z0-9]/g; -const multipleDashesRegex = /--+/g; -const trailingDashRegex = /-$/g; -const leadingDashRegex = /^-/g; - const nationSlugDiscriminators = { china: "cn", european: "eu", @@ -770,11 +765,7 @@ export async function definitions() { getString(tank.userString) ).locales.en; - let slug = deburr(name).toLowerCase(); - slug = slug.replaceAll(nonAlphanumericRegex, "-"); - slug = slug.replaceAll(multipleDashesRegex, "-"); - slug = slug.replaceAll(trailingDashRegex, ""); - slug = slug.replaceAll(leadingDashRegex, ""); + let slug = slugify(name); idToNation[tankId] = nation; diff --git a/packages/website/package.json b/packages/website/package.json index 359694ca1..a32568a55 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -42,6 +42,7 @@ "react-promise-suspense": "^0.3.4", "three": "^0.180.0", "three-stdlib": "^2.36.0", + "transliteration": "^2.6.1", "typescript": "^5.9.3", "urlon": "^3.1.0", "varuna": "workspace:*",