forked from tobspr-games/shapez.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
translations.js
66 lines (61 loc) · 1.94 KB
/
translations.js
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
// @ts-nocheck
const METADATA = {
website: "https://tobspr.io",
author: "tobspr",
name: "Mod Example: Translations",
version: "1",
id: "translations",
description: "Shows how to add and modify translations",
minimumGameVersion: ">=1.5.0",
// You can specify this parameter if savegames will still work
// after your mod has been uninstalled
doesNotAffectSavegame: true,
};
class Mod extends shapez.Mod {
init() {
// Replace an existing translation in the english language
this.modInterface.registerTranslations("en", {
ingame: {
interactiveTutorial: {
title: "Hello",
hints: {
"1_1_extractor": "World!",
},
},
},
});
// Replace an existing translation in german
this.modInterface.registerTranslations("de", {
ingame: {
interactiveTutorial: {
title: "Hallo",
hints: {
"1_1_extractor": "Welt!",
},
},
},
});
// Add an entirely new translation which is localized in german and english
this.modInterface.registerTranslations("en", {
mods: {
mymod: {
test: "Test Translation",
},
},
});
this.modInterface.registerTranslations("de", {
mods: {
mymod: {
test: "Test Übersetzung",
},
},
});
// Show a dialog in the main menu
this.signals.stateEntered.add(state => {
if (state instanceof shapez.MainMenuState) {
// Will show differently based on the selected language
this.dialogs.showInfo("My translation", shapez.T.mods.mymod.test);
}
});
}
}