Skip to content

Commit 46053a6

Browse files
committed
improve(i18n): localize building names
1 parent 944fe85 commit 46053a6

2 files changed

Lines changed: 95 additions & 13 deletions

File tree

src/database/services/useBuildingData.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { computed } from "vue";
2+
import { i18n } from "@/lib/i18n";
3+
import type { Composer } from "vue-i18n";
24

35
import { useDB } from "@/database/composables/useDB";
46
import { recipesStore, buildingsStore } from "@/database/stores";
@@ -38,6 +40,8 @@ export async function useBuildingData() {
3840
preload: preloadRecipes,
3941
} = useDB(recipesStore);
4042

43+
const { t } = i18n.global as unknown as Composer;
44+
4145
const { getPlanetSpecialMaterials } = usePlanetData();
4246
const { combineMaterialIOMinimal } = await useMaterialIOUtil();
4347
const { calculateWorkforceConsumption } = await useWorkforceCalculation();
@@ -105,19 +109,7 @@ export async function useBuildingData() {
105109

106110
options.push({
107111
value: building.building_ticker,
108-
label:
109-
building.building_ticker +
110-
" (" +
111-
building.building_name
112-
.replace(/([A-Z])/g, " $1")
113-
.trim()
114-
.charAt(0)
115-
.toUpperCase() +
116-
building.building_name
117-
.replace(/([A-Z])/g, " $1")
118-
.trim()
119-
.slice(1) +
120-
")",
112+
label: `${building.building_ticker} (${t(`game.building.${building.building_ticker}`)})`,
121113
});
122114
}
123115
});

src/locales/en_US/game.json

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,96 @@
3030
"METALLURGY": "Metallurgy",
3131
"RESOURCE_EXTRACTION": "Resource Extraction"
3232
},
33+
"building": {
34+
"4DA": "4D Arcades",
35+
"AAF": "Advanced Appliances Factory",
36+
"ACA": "Art Café",
37+
"ADM": "Administration Center",
38+
"AML": "Advanced Material Lab",
39+
"APF": "Appliances Factory",
40+
"ART": "Art Gallery",
41+
"ASM": "High-Power Blast Furnace",
42+
"BMP": "Basic Materials Plant",
43+
"CFL": "Corporation FTL Laboratory",
44+
"CHP": "Chemical Plant",
45+
"CIM": "Corporate Immortality Center",
46+
"CLF": "Textile Manufacturing",
47+
"CLR": "Cleanroom",
48+
"CM": "Core Module",
49+
"COG": "Chamber of Global Commerce",
50+
"COL": "Collector",
51+
"COR": "Corporation Headquarters",
52+
"CRC": "APEX Representation Center",
53+
"CTE": "Corporate Terraformer",
54+
"DRS": "Drone Shop",
55+
"ECA": "Energy Component Assembly",
56+
"EDM": "Electronic Device Manufactory",
57+
"EEP": "Einsteinium Enrichment",
58+
"ELP": "Electronics Plant",
59+
"EMC": "Emergency Center",
60+
"EXT": "Extractor",
61+
"FER": "Fermenter",
62+
"FP": "Food Processor",
63+
"FRM": "Farmstead",
64+
"FS": "Metalist Studio",
65+
"GF": "Glass Furnace",
66+
"HB1": "Pioneer Habitation",
67+
"HB2": "Settler Habitation",
68+
"HB3": "Technician Habitation",
69+
"HB4": "Engineer Habitation",
70+
"HB5": "Scientist Habitation",
71+
"HBB": "Barracks",
72+
"HBC": "Communal Abode",
73+
"HBL": "Luxury Residence",
74+
"HBM": "Management Domicile",
75+
"HOS": "Hospital",
76+
"HWP": "Hull Welding Plant",
77+
"HYF": "Hydroponics Farm",
78+
"INC": "Incinerator",
79+
"INF": "Infirmary",
80+
"IVP": "In-Vitro Plant",
81+
"LAB": "Laboratory",
82+
"LIB": "Library",
83+
"LM": "Local Market",
84+
"MCA": "Medium Components Assembly",
85+
"ORC": "Orchard",
86+
"PAC": "Packaging Center",
87+
"PAR": "Wildlife Park",
88+
"PBH": "Planetary Broadcasting Hub",
89+
"PHF": "Pharma Factory",
90+
"POL": "Polymer Plant",
91+
"PP1": "Prefab Plant MK1",
92+
"PP2": "Prefab Plant MK2",
93+
"PP3": "Prefab Plant MK3",
94+
"PP4": "Prefab Plant MK4",
95+
"PPF": "3D Printer",
96+
"PSY": "Planetary Shipyard",
97+
"PWH": "Planetary Warehouse",
98+
"REF": "Refinery",
99+
"RIG": "Rig",
100+
"SCA": "Small Components Assembly",
101+
"SD": "Software Development",
102+
"SDP": "Security Drone Post",
103+
"SE": "Software Engineering",
104+
"SKF": "Ship Kit Factory",
105+
"SL": "Software Labs",
106+
"SME": "Smelter",
107+
"SPF": "Spacecraft Propulsion Factory",
108+
"SPP": "Spacecraft Prefab Planet",
109+
"SST": "Safety Station",
110+
"STA": "Auxiliary Storage",
111+
"STE": "Expansive Storage",
112+
"STO": "Storage Facility",
113+
"STV": "Volume Storage",
114+
"STW": "Weight Storage",
115+
"TNP": "Technetium Processing",
116+
"UNI": "University",
117+
"UPF": "Unit Prefab Plant",
118+
"VRT": "VR Theater",
119+
"WCE": "Wellness Center",
120+
"WEL": "Welding Plant",
121+
"WPL": "Weaving Plant"
122+
},
33123
"cogc_program": {
34124
"Invalid": "Invalid",
35125
"NONE": "None",

0 commit comments

Comments
 (0)