From 46053a6b78b04e2e6915bb442c0077a1db0304a3 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 11 May 2026 12:08:36 +0200 Subject: [PATCH] improve(i18n): localize building names --- src/database/services/useBuildingData.ts | 18 ++--- src/locales/en_US/game.json | 90 ++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 13 deletions(-) diff --git a/src/database/services/useBuildingData.ts b/src/database/services/useBuildingData.ts index aeab15a7..517222c5 100644 --- a/src/database/services/useBuildingData.ts +++ b/src/database/services/useBuildingData.ts @@ -1,4 +1,6 @@ import { computed } from "vue"; +import { i18n } from "@/lib/i18n"; +import type { Composer } from "vue-i18n"; import { useDB } from "@/database/composables/useDB"; import { recipesStore, buildingsStore } from "@/database/stores"; @@ -38,6 +40,8 @@ export async function useBuildingData() { preload: preloadRecipes, } = useDB(recipesStore); + const { t } = i18n.global as unknown as Composer; + const { getPlanetSpecialMaterials } = usePlanetData(); const { combineMaterialIOMinimal } = await useMaterialIOUtil(); const { calculateWorkforceConsumption } = await useWorkforceCalculation(); @@ -105,19 +109,7 @@ export async function useBuildingData() { options.push({ value: building.building_ticker, - label: - building.building_ticker + - " (" + - building.building_name - .replace(/([A-Z])/g, " $1") - .trim() - .charAt(0) - .toUpperCase() + - building.building_name - .replace(/([A-Z])/g, " $1") - .trim() - .slice(1) + - ")", + label: `${building.building_ticker} (${t(`game.building.${building.building_ticker}`)})`, }); } }); diff --git a/src/locales/en_US/game.json b/src/locales/en_US/game.json index f3e19d40..addb35aa 100644 --- a/src/locales/en_US/game.json +++ b/src/locales/en_US/game.json @@ -30,6 +30,96 @@ "METALLURGY": "Metallurgy", "RESOURCE_EXTRACTION": "Resource Extraction" }, + "building": { + "4DA": "4D Arcades", + "AAF": "Advanced Appliances Factory", + "ACA": "Art Café", + "ADM": "Administration Center", + "AML": "Advanced Material Lab", + "APF": "Appliances Factory", + "ART": "Art Gallery", + "ASM": "High-Power Blast Furnace", + "BMP": "Basic Materials Plant", + "CFL": "Corporation FTL Laboratory", + "CHP": "Chemical Plant", + "CIM": "Corporate Immortality Center", + "CLF": "Textile Manufacturing", + "CLR": "Cleanroom", + "CM": "Core Module", + "COG": "Chamber of Global Commerce", + "COL": "Collector", + "COR": "Corporation Headquarters", + "CRC": "APEX Representation Center", + "CTE": "Corporate Terraformer", + "DRS": "Drone Shop", + "ECA": "Energy Component Assembly", + "EDM": "Electronic Device Manufactory", + "EEP": "Einsteinium Enrichment", + "ELP": "Electronics Plant", + "EMC": "Emergency Center", + "EXT": "Extractor", + "FER": "Fermenter", + "FP": "Food Processor", + "FRM": "Farmstead", + "FS": "Metalist Studio", + "GF": "Glass Furnace", + "HB1": "Pioneer Habitation", + "HB2": "Settler Habitation", + "HB3": "Technician Habitation", + "HB4": "Engineer Habitation", + "HB5": "Scientist Habitation", + "HBB": "Barracks", + "HBC": "Communal Abode", + "HBL": "Luxury Residence", + "HBM": "Management Domicile", + "HOS": "Hospital", + "HWP": "Hull Welding Plant", + "HYF": "Hydroponics Farm", + "INC": "Incinerator", + "INF": "Infirmary", + "IVP": "In-Vitro Plant", + "LAB": "Laboratory", + "LIB": "Library", + "LM": "Local Market", + "MCA": "Medium Components Assembly", + "ORC": "Orchard", + "PAC": "Packaging Center", + "PAR": "Wildlife Park", + "PBH": "Planetary Broadcasting Hub", + "PHF": "Pharma Factory", + "POL": "Polymer Plant", + "PP1": "Prefab Plant MK1", + "PP2": "Prefab Plant MK2", + "PP3": "Prefab Plant MK3", + "PP4": "Prefab Plant MK4", + "PPF": "3D Printer", + "PSY": "Planetary Shipyard", + "PWH": "Planetary Warehouse", + "REF": "Refinery", + "RIG": "Rig", + "SCA": "Small Components Assembly", + "SD": "Software Development", + "SDP": "Security Drone Post", + "SE": "Software Engineering", + "SKF": "Ship Kit Factory", + "SL": "Software Labs", + "SME": "Smelter", + "SPF": "Spacecraft Propulsion Factory", + "SPP": "Spacecraft Prefab Planet", + "SST": "Safety Station", + "STA": "Auxiliary Storage", + "STE": "Expansive Storage", + "STO": "Storage Facility", + "STV": "Volume Storage", + "STW": "Weight Storage", + "TNP": "Technetium Processing", + "UNI": "University", + "UPF": "Unit Prefab Plant", + "VRT": "VR Theater", + "WCE": "Wellness Center", + "WEL": "Welding Plant", + "WPL": "Weaving Plant" + }, "cogc_program": { "Invalid": "Invalid", "NONE": "None",