mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 15:04:52 +09:00
Fix export missing localised name
The change in #838 removed localised names from the exported metadata. Add it back again so that items with overriden names are translated.
This commit is contained in:
1 parent
076fb933dc
commit
4c01f6a789
3 files changed
+8
-2
No files matched your search
@@ -411,6 +411,7 @@ async function exportItems(
|
||||
x: iconPos * SHEET_ICON_SIZE % SHEET_WIDTH,
|
||||
y: Math.floor(iconPos / (SHEET_WIDTH / SHEET_ICON_SIZE)) * SHEET_ICON_SIZE,
|
||||
size: SHEET_ICON_SIZE,
|
||||
localised_name: item.localised_name,
|
||||
category,
|
||||
...(iconPath ? { path: iconPath } : {}),
|
||||
});
|
||||
|
||||
@@ -113,6 +113,7 @@ export interface ExportMetadataEntry {
|
||||
x: number,
|
||||
y: number,
|
||||
size: number,
|
||||
localised_name?: FactorioLocalisedString,
|
||||
category: string,
|
||||
path?: string,
|
||||
}
|
||||
|
||||
@@ -41,9 +41,13 @@ function StoragePage() {
|
||||
function getLocaleName(itemName: string) {
|
||||
let localeName = itemName;
|
||||
let meta = itemMetadata.get(itemName);
|
||||
if (meta && (meta as any).localised_name) {
|
||||
if (meta && meta.localised_name) {
|
||||
// TODO: implement the locale to name conversion.
|
||||
localeName = locale.get((meta as any).localised_name[0])!;
|
||||
if (typeof meta.localised_name === "string") {
|
||||
localeName = meta.localised_name;
|
||||
} else {
|
||||
localeName = locale.get(meta.localised_name[0])!;
|
||||
}
|
||||
} else {
|
||||
for (let section of ["item-name", "entity-name", "fluid-name", "equipment-name"]) {
|
||||
let name = locale.get(`${section}.${itemName}`);
|
||||
|
||||
Reference in new issue
Block a user