Weapon translations

This commit is contained in:
Kalle 2022-08-28 16:29:51 +03:00
parent 820dfc7668
commit 3c67aeac63
3 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,55 @@
{
"0": "Sploosh-o-matic",
"10": "Splattershot Jr.",
"20": "Splash-o-matic",
"30": "Aerospray MG",
"40": "Splattershot",
"50": ".52 Gal",
"60": "N-ZAP '85",
"70": "Splattershot Pro",
"80": ".96 Gal",
"90": "Jet Squelcher",
"200": "Luna Blaster",
"210": "Blaster",
"220": "Range Blaster",
"230": "Clash Blaster",
"240": "Rapid Blaster",
"250": "Rapid Blaster Pro",
"300": "L-3 Nozzlenose",
"310": "H-3 Nozzlenose",
"400": "Squeezer",
"1000": "Carbon Roller",
"1010": "Splat Roller",
"1020": "Dynamo Roller",
"1030": "Flingza Roller",
"1100": "Inkbrush",
"1110": "Octobrush",
"2000": "Classic Squiffer",
"2010": "Splat Charger",
"2020": "Splatterscope",
"2030": "E-liter 4K",
"2040": "E-liter 4K Scope",
"2050": "Bamboozler 14 Mk I",
"2060": "Goo Tuber",
"3000": "Slosher",
"3010": "Tri-Slosher",
"3020": "Sloshing Machine",
"3030": "Bloblobber",
"3040": "Explosher",
"4000": "Mini Splatling",
"4010": "Heavy Splatling",
"4020": "Hydra Splatling",
"4030": "Ballpoint Splatling",
"4040": "Nautilus 47",
"5000": "Dapple Dualies",
"5010": "Splat Dualies",
"5020": "Glooga Dualies",
"5030": "Dualie Squelchers",
"5040": "Dark Tetra Dualies",
"6000": "Splat Brella",
"6010": "Tenta Brella",
"6020": "Undercover Brella",
"7010": "Tri-Stringer",
"8000": "Splatana Stamper",
"8010": "Splatana Wiper"
}

View File

@ -6,6 +6,7 @@ import invariant from "tiny-invariant";
const INTERNAL_NAMES_TO_IGNORE: readonly string[] = ["Free"] as const;
const LANG_DICTS_PATH = path.join(__dirname, "dicts", "langs");
const OUTPUT_DIR_PATH = path.join(__dirname, "output");
const LANG_JSONS_TO_CREATE = ["EUen"];
async function loadLangDicts() {
const result: Array<
@ -69,6 +70,27 @@ async function main() {
path.join(OUTPUT_DIR_PATH, "weapon-ids.json"),
JSON.stringify(weaponIds, null, 2)
);
for (const langCode of LANG_JSONS_TO_CREATE) {
const translationsMap = Object.fromEntries(
result.map((w) => {
const translation = w.translations.find(
(t) => t.language === langCode
)?.name;
invariant(
translation,
`No translation for ${w.internalName} in ${langCode}`
);
return [w.id, translation];
})
);
fs.writeFileSync(
path.join(OUTPUT_DIR_PATH, `weapon-${langCode}.json`),
JSON.stringify(translationsMap, null, 2)
);
}
}
void main();

View File

@ -7,6 +7,7 @@ import type contributions from "../public/locales/en/contributions.json";
import type user from "../public/locales/en/user.json";
import type badges from "../public/locales/en/badges.json";
import type calendar from "../public/locales/en/calendar.json";
import type weapons from "../public/locales/en/weapons.json";
declare module "react-i18next" {
interface CustomTypeOptions {
@ -19,6 +20,7 @@ declare module "react-i18next" {
user: typeof user;
badges: typeof badges;
calendar: typeof calendar;
weapons: typeof weapons;
};
}
}