forked from JoeJoesGit/AlchemyFactoryCalculator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalchemy_i18n.js
More file actions
470 lines (431 loc) · 16.3 KB
/
alchemy_i18n.js
File metadata and controls
470 lines (431 loc) · 16.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
// Translation helper function
function t(text, category = 'ui') {
if (!text) return "";
if (window.ALCHEMY_I18N.enabled === false) return text;
const i18n = window.ALCHEMY_I18N;
const translatedText = i18n?.[category]?.[text];
if (!translatedText && category != 'ui') {
console.warn(`[i18n][${category}] Missing: ${text}`);
}
return translatedText ?? text;
}
function translateDatabase(db, forward) {
const i18n = window.ALCHEMY_I18N;
if (!db || !i18n || !i18n.items) return;
if (i18n.enabled === false) return;
const item2translate = new Map();
const translate2item = new Map();
for (let key in i18n.items) {
const value = i18n.items[key];
item2translate.set(key, value);
translate2item.set(value, key);
}
const forwardMap = forward ? item2translate : translate2item;
const invertedMap = forward ? translate2item : item2translate;
const missingKeys = new Set();
const getT = (str) => {
if (!str) return str;
const translated = forwardMap.get(str);
if (translated === undefined) {
if (!invertedMap.has(str)) missingKeys.add(str);
return str;
}
return translated;
};
// Destructive replace the item keys
if (db.items) {
const newItems = {};
for (let key in db.items) {
const newKey = getT(key);
const itemData = db.items[key];
newItems[newKey] = itemData;
}
db.items = newItems;
}
if (db.machines) {
const newMachines = {};
for (let key in db.machines) {
const machineData = db.machines[key];
if (machineData.buildCost) {
const newCost = {};
for (let mat in machineData.buildCost) {
newCost[getT(mat)] = machineData.buildCost[mat];
}
machineData.buildCost = newCost;
}
newMachines[key] = machineData;
}
db.machines = newMachines;
}
if (db.recipes) {
db.recipes.forEach(recipe => {
const newInputs = {};
for (let inKey in recipe.inputs) {
newInputs[getT(inKey)] = recipe.inputs[inKey];
}
recipe.inputs = newInputs;
const newOutputs = {};
for (let outKey in recipe.outputs) {
newOutputs[getT(outKey)] = recipe.outputs[outKey];
}
recipe.outputs = newOutputs;
});
}
if (db.settings) {
if (db.settings.defaultFuel) db.settings.defaultFuel = getT(db.settings.defaultFuel);
if (db.settings.defaultFert) db.settings.defaultFert = getT(db.settings.defaultFert);
const newPrefs = {};
for (let itemKey in db.settings.preferredRecipes) {
newPrefs[getT(itemKey)] = db.settings.preferredRecipes[itemKey];
}
db.settings.preferredRecipes = newPrefs;
const customCosts = {};
for (let itemKey in db.settings.customCosts) {
customCosts[getT(itemKey)] = db.settings.customCosts[itemKey];
}
db.settings.customCosts = customCosts;
}
if (missingKeys.size > 0) {
console.warn(`DB Translate: Missing ${missingKeys.size} keys\n` + [...missingKeys]);
}
console.log("Database successfully translated.");
}
window.ALCHEMY_I18N = {
"version": 1,
"enabled": true,
"ui": {
// --- 0. Title ---
"Alchemy Factory Calculator": "炼金工厂计算器",
"Game version : ": "游戏版本 : ",
"Calculator": "计算器",
"Cauldron": "炼金锅",
"Advanced Cauldron": "高级炼金锅",
"Database Editor": "数据库",
"New database version available": "发现新版本数据库",
"Current local version:": "您的本地版本为:",
"Update Now": "立即更新",
"Skip Update": "略过更新",
"Reset All Database?": "是否重置所有数据库?",
// --- 1. Production Goal ---
"Production Goal": "生产目标",
"MULTI": "多产物",
"+ Add Item": "+ 添加需求物品",
"💾 Save List": "💾 保存列表",
"📂 Load List": "📂 加载列表",
"Target Item": "目标物品",
"Select or Type...": "选择或输入...",
"Set by Machine Count": "按机器数量设置",
"Machine Count": "机器数量",
"Belt Load Fraction": "传送带负载比例",
"Belt": "带",
"Custom Rate": "自定义速率",
"Rate (Items/Min)": "速率 (个/分钟)",
"Select Item": "选择物品",
"Expand All": "全部展开",
"Collapse All": "全部收起",
"All Items": "所有物品",
"Browse Items": "浏览物品清单",
// --- 2. Logistics ---
"Logistics": "物流设置",
"Heat Source": "燃料来源",
"Fertilizer Source": "肥料来源",
"Self-Fuel: OFF": "自供燃料: 关",
"Self-Fuel: ON": "自供燃料: 开",
"Self-Fert: OFF": "自供肥料: 关",
"Self-Fert: ON": "自供肥料: 开",
"Make Default": "设为默认",
"Current Default": "当前默认",
"Cost (G/item):" : "成本设置(每个):",
"Show Machine Max Cap": "显示机器产能上限",
"Show Machine Heat & Nutr": "显示机器热值&肥力用量",
"Show Belt Count": "显示传送带需求",
// --- 3. Tree & Nodes ---
"Gross Output": "总产出",
"Total Load": "总负载",
"Unit Cost": "单位成本",
"Unit Value": "单位价值",
"Coin": "铜币",
"Heat": "热值",
"Nutr": "肥力",
"Conversion Cost": "总成本",
"Retail Price ": "零售价",
"Wholesale Price": "批发价",
"Production Chain": "生产链",
"Recycle All": "全部回收",
"Un-recycle All": "全部不回收",
"Select Recipe": "选择配方",
"Select Recipe for ": "切换配方 ",
"Input": "输入",
"Yields": "产出",
"Avail": "可用",
"Used": "已用",
"Raw Input": "原料输入",
"External Input": "外部输入",
"Recipe": "配方",
"Base Time": "原始时间",
"Speed Mult": "速度倍率",
"Throughput": "单设备产量",
"Internal Nutrient Module": "内部肥料模块",
"Internal Heat Module": "内部燃料模块",
"Common Nodes": "共同节点",
"--- External Inputs ---": "--- 外部输入 ---",
"Raw Material Cost": "原料成本",
"Fuel Import": "燃料输入",
"Fertilizer Import": "肥料输入",
"--- BYPRODUCTS ---": "--- 副产物 ---",
"None": "无",
"recycled": "已回收",
// --- 4. Construction List ---
"Construction List": "建造清单",
"Total Materials Required": "总计材料需求",
"Total Slots": "总计格子数",
// --- 5. Upgrades ---
"Upgrades (Levels)": "升级",
"Logistics Efficiency": "物流效率",
"Factory Efficiency": "工厂效率",
"Alchemy Skill": "炼金技术",
"Fuel Efficiency": "燃料效率",
"Fert Efficiency": "肥料效率",
// --- 6. Save/Reset ---
"Save/Reset": "保存/重置",
"Save Upgrades": "保存设置",
"Reset Recipes": "重置配方数据",
"Reset Translations": "重置翻译",
"All Data Reset": "全部重置",
// --- 7. Data Editor ---
"Apply Changes": "应用更改",
"Export to File": "导出到文件",
// --- Cauldron ---
"Settings & Candidates": "炼金原料设置",
"Profile 1": "原料池1",
"Profile 2": "原料池2",
"Profile 3": "原料池3",
"Filter Category": "筛选分类",
"Select All": "全选",
"Deselect All": "取消全选",
"Sort by Value": "以炼金价值排序",
"Real-time": "实时",
"Filtered Results": "炼金配方匹配结果",
"Number of matching recipes" : "符合条件的配方总数",
"Calculate All": "计算全部",
"Set Input": "指定原料",
"2 Diff": "2件不同",
"3 Diff": "3件不同",
"2 Same": "2件相同",
"3 Same": "3件相同",
"Unattainable Targets": "无法达成的目标",
"Saved Recipes": "已保存配方",
"Import": "导入",
"Export": "导出",
"Sync DB": "同步数据库",
"No saved recipes yet.": "暂无保存的配方。"
},
"items": {
// Game version: 0.4.3.4071
// Group by meaning
// --- RAW RESOURCES ---
"Logs": "原木",
"Limestone": "石灰石",
"Iron Ore": "铁矿石",
"Pyrite Ore": "硫铁矿",
"Quartz Ore": "石英矿",
"Rock Salt": "岩盐",
"Coal Ore": "煤矿石",
"Rotten Log": "腐烂原木",
"Meteorite": "陨石",
// --- SEEDS ---
"Flax Seeds": "亚麻种子",
"Sage Seeds": "鼠尾草种子",
"Redcurrant Seeds": "红醋栗种子",
"Lavender Seeds": "薰衣草种子",
"Chamomile Seeds": "洋甘菊种子",
"Gentian Seeds": "龙胆花种子",
"World Tree Seed": "世界树种子",
// --- HERBS ---
"Flax": "亚麻",
"Sage": "鼠尾草",
"Redcurrant": "红醋栗",
"Lavender": "薰衣草",
"Chamomile": "洋甘菊",
"Gentian": "龙胆花",
"Gentian Nectar": "龙胆花蜜",
"World Tree Leaf": "世界树之叶",
"World Tree Core": "世界树核心",
"Gloom Fungus": "幽暗菇",
// --- FUELS & FERTILIZERS---
"Plank": "木材",
"Charcoal": "木炭",
"Charcoal Powder": "木炭粉",
"Coke": "焦炭",
"Coke Powder": "焦炭粉",
"Coal": "煤炭",
"Black Powder": "火药",
"Basic Fertilizer": "初级肥料",
"Advanced Fertilizer": "高级肥料",
// --- SOLIDS & MATERIALS ---
"Stone": "碎石",
"Sand": "沙子",
"Clay": "粘土",
"Brick": "砖头",
"Glass": "玻璃",
"Sulfur": "硫磺",
"Salt": "盐",
// --- POWDERS & DUSTS ---
"Flax Fiber": "亚麻纤维",
"Sage Powder": "鼠尾草粉",
"Plant Ash": "植物灰",
"Quicklime": "生石灰",
"Quicklime Powder": "石灰粉",
"Clay Powder": "粘土粉",
"Sulfur Powder": "硫磺粉",
"Chamomile Powder": "洋甘菊粉",
"Gentian Powder": "龙胆花粉",
"Yeast Powder": "酵母粉",
"Soap Powder": "肥皂粉",
"Perfumed Soap Powder": "香皂粉",
"Volcanic Ash": "火山灰",
"Star Dust": "星之尘",
"Fairy Dust": "精灵粉末",
// --- METALS ---
"Iron Sand": "铁砂",
"Iron Ingot": "铁锭",
"Steel Ingot": "钢锭",
"Impure Copper Powder": "不纯的铜粉",
"Bronze Ingot": "青铜锭",
"Copper Powder": "铜粉",
"Copper Ingot": "铜锭",
"Crude Silver Powder": "粗劣的银粉",
"Impure Silver Powder": "不纯的银粉",
"Silver Powder": "银粉",
"Silver Ingot": "银锭",
"Crude Gold Dust": "粗劣的砂金",
"Impure Gold Dust": "不纯的砂金",
"Gold Dust": "砂金",
"Pure Gold Dust": "纯净的砂金",
"Gold Ingot": "金锭",
// --- COMPONENTS ---
"Linen Thread": "亚麻线",
"Linen Rope": "麻绳",
"Large Wooden Gear": "木制大齿轮",
"Small Wooden Gear": "木制小齿轮",
"Iron Nails": "铁钉",
"Wooden Pulley": "木滑轮",
"Steel Gear": "钢齿轮",
"Copper Bearing": "铜轴承",
"Bronze Rivet": "青铜铆钉",
// --- GOODS & CURRENCY ---
"Mortar": "研钵",
"Linen": "麻布",
"Bandage": "绷带",
"Soap": "肥皂",
"Perfumed Soap": "香皂",
"Moonlit Soap": "月光皂",
"Pocket Watch": "怀表",
"Clockwork Bird": "发条鸟",
"Silver Amulet": "银护身符",
"Crown": "皇冠",
"Copper Coin": "铜币",
"Silver Coin": "银币",
"Gold Coin": "金币",
// --- LIQUIDS ---
"Linseed Oil": "亚麻籽油",
"Fruit Wine": "浆果酒",
"Limewater": "石灰水",
"Brine": "盐水",
"Lavender Essential Oil": "薰衣草精油",
"Brandy": "白兰地",
"Sulfuric Acid": "硫酸",
"Quicksilver": "水银",
"Aqua Vitae": "生命之水",
"Fairy Tear": "精灵之泪",
"Moon Tear": "月之泪",
// --- POTIONS ---
"Healing Potion": "治疗药水",
"Vitality Potion": "活力药水",
"Transformation Potion": "变形药水",
"Blast Potion": "爆炸药水",
"Growth Potion": "成长药水",
"Panacea Potion": "万灵药",
// --- CATALYSTS & MAGIC ---
"Gloom Spores": "幽暗孢子",
"Unstable Catalyst": "不稳定催化剂",
"Fertile Catalyst": "丰饶催化剂",
"Resonant Catalyst": "共振催化剂",
"Eternal Catalyst": "永恒催化剂",
"Oblivion Essence": "湮灭精华",
"Vitality Essence": "生命精华",
"Philosopherˈs Stone": "贤者之石",
// --- GEMS & SHARDS ---
"Crude Shard": "粗劣的晶片",
"Broken Shard": "破碎的晶片",
"Dull Shard": "暗淡的晶片",
"Shattered Crystal": "碎裂的晶石",
"Crude Crystal": "粗糙的晶石",
"Polished Crystal": "抛光的晶石",
"Adamant": "金刚石",
"Diamond": "钻石",
"Perfect Diamond": "完美的钻石",
"Turquoise": "绿松石",
"Malachite": "孔雀石",
"Topaz": "黄玉",
"Obsidian": "黑曜石",
"Lapis Lazuli": "青金石",
"Ruby": "红宝石",
"Sapphire": "蓝宝石",
"Emerald": "祖母绿",
// --- RELICS ---
"Jupiter": "木星",
"Saturn": "土星",
"Mars": "火星",
"Venus": "金星",
"Mercury": "水星",
"Luna": "月曜",
"Sol": "日耀",
// --- SPECIAL ---
"Portal Sigil": "传送门印章",
"Gelatinous Gridlock": "格姆胶",
"Automatic Cashier": "自动收银机"
},
"machines": {
"Table Saw": "锯木机",
"Stone Crusher": "碎石机",
"Seed Plot": "种植地块",
"Grinder": "研磨机",
"Enhanced Grinder": "强化研磨机",
"Extractor": "萃取机",
"Thermal Extractor": "热能萃取机",
"Stone Furnace": "石炉",
"Blast Furnace": "高温炉",
"Crucible": "坩埚",
"Stackable Crucible": "可堆叠坩埚",
"Paradox Crucible": "悖论坩埚",
"Cauldron": "炼金锅",
"Advanced Cauldron": "高级炼金锅",
"Kiln": "土窑",
"Iron Smelter": "炼铁炉",
"Refiner": "精炼机",
"Processor": "加工机",
"Arcane Processor": "奥术加工机",
"Assembler": "组装机",
"Advanced Assembler": "高级组装机",
"Blender": "混合机",
"Advanced Blender": "高级混合机",
"Alembic": "蒸馏器",
"Advanced Alembic": "高级蒸馏器",
"Athanor": "炼金炉",
"Advanced Athanor": "高级炼金炉",
"Shaper": "雕刻机",
"Advanced Shaper": "高级雕刻机",
"Arcane Shaper": "奥术雕刻机",
"Nursery": "育苗圃",
"World Tree Nursery": "世界树育苗圃",
"Knowledge Altar": "知识祭坛",
"Purchasing Portal": "进货传送门",
"Bank Portal": "银行传送门"
},
"categories": {
"Raw Materials": "原材料", "Seeds": "种子", "Herbs": "草药", "Fuel": "燃料", "Fertilizer": "肥料", "Solid": "固体", "Crystal": "晶石", "Component": "零件", "Liquid": "液体",
"Mash": "研磨物", "Metal Mash": "金属粉", "Potion": "药水", "Catalyst": "催化剂", "Magic": "魔法", "Jewelry": "珠宝", "Relic": "圣物", "Currency": "货币", "Misc" : "杂项", "Other": "其他",
"[All]": "[ 全部 ]", "[Include]": "[ 选取 ]", "[Exclude]": "[ 排除 ]", "[Product]": "[ 产物 ]"
}
};