Skip to content

Commit f9c8398

Browse files
authored
Merge pull request #16 from TerminalHash/Translations
Translations System
2 parents 6b54a88 + 6e74ada commit f9c8398

File tree

12 files changed

+277
-92
lines changed

12 files changed

+277
-92
lines changed

BindingStuff/BindingsCommon.as

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
1+
#include "TranslationsSystem.as"
2+
13
string BINDINGSDIR = "../Cache/";
24
string BINDINGSFILE = "GRUHSHA_playerbindings";
35

46
string[] page_texts =
57
{
6-
"Emotes",
7-
"Tags"
8+
Names::modbindsmenu
89
};
910

10-
1111
string[][] button_texts =
1212
{
13-
{
14-
"Emote 1 (NOT USABLE)",
15-
"Emote 2 (NOT USABLE)",
16-
"Emote 3 (NOT USABLE)",
17-
"Emote 4 (NOT USABLE)",
18-
"Emote 5 (NOT USABLE)",
19-
"Emote 6 (NOT USABLE)",
20-
"Emote 7 (NOT USABLE)",
21-
"Emote 8 (NOT USABLE)",
22-
"Emote 9 (NOT USABLE)",
23-
"Emote Wheel",
24-
"Emote Wheel 2"
25-
},
2613
{
2714
"GO HERE",
2815
"DIG HERE",
@@ -32,25 +19,13 @@ string[][] button_texts =
3219
"HELP",
3320
"KEG",
3421
"WiT SENCE",
35-
"Tag wheel"
22+
Names::tagwheel,
23+
Names::emotewheelsecond
3624
},
3725
};
3826

3927
string[][] button_file_names =
4028
{
41-
{
42-
"emote1",
43-
"emote2",
44-
"emote3",
45-
"emote4",
46-
"emote5",
47-
"emote6",
48-
"emote7",
49-
"emote8",
50-
"emote9",
51-
"emote_wheel",
52-
"emote_wheel_two"
53-
},
5429
{
5530
"tag1",
5631
"tag2",
@@ -60,7 +35,8 @@ string[][] button_file_names =
6035
"tag6",
6136
"tag7",
6237
"tag8",
63-
"tag_wheel"
38+
"tag_wheel",
39+
"emote_wheel_two"
6440
},
6541
};
6642

@@ -271,7 +247,7 @@ class ClickableButton
271247
this.m_clickable = true;
272248
this.m_selected = false;
273249
this.deselect_instantly = false;
274-
this.bindings.push_back("placeholder");
250+
this.bindings.push_back(Descriptions::modbindplaceholder);
275251
//printf("Init button");
276252
}
277253

@@ -768,7 +744,7 @@ class ClickableButtonGUI
768744
}
769745
}
770746

771-
GUI::DrawTextCentered("Press [DELETE] to remove bind", m_clickable_origin + Vec2f(m_clickable_size.x * 0.5, m_clickable_size.y - 40), SColor(255, 255, 255, 255));
747+
GUI::DrawTextCentered(Names::pressdelete, m_clickable_origin + Vec2f(m_clickable_size.x * 0.5, m_clickable_size.y - 40), SColor(255, 255, 255, 255));
772748
}
773749
else
774750
{

CaptainsStuff/PickingCommands.as

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
#include "PickingCommon.as"
44
#include "ApprovedTeams.as"
55
#include "BindingsCommon.as"
6+
#include "TranslationsSystem.as"
67

78
class SpecAllCommand : ChatCommand
89
{
910
SpecAllCommand()
1011
{
11-
super("specall", "Puts everyone in Spectators");
12+
super("specall", Descriptions::specallcomtext);
1213
}
1314

1415
bool canPlayerExecute(CPlayer@ player)
@@ -33,7 +34,7 @@ class AppointCommand : ChatCommand
3334
{
3435
AppointCommand()
3536
{
36-
super("appoint", "Appoints two Team Leaders (they pick players in their teams)");
37+
super("appoint", Descriptions::appointcomtext);
3738
AddAlias("caps");
3839
SetUsage("<blue leader username> <red leader username>");
3940
}
@@ -94,7 +95,7 @@ class DemoteCommand : ChatCommand
9495
{
9596
DemoteCommand()
9697
{
97-
super("demote", "Demotes the Team Leaders");
98+
super("demote", Descriptions::demotecomtext);
9899
}
99100

100101
bool canPlayerExecute(CPlayer@ player)
@@ -115,7 +116,7 @@ class PickPlayerCommand : ChatCommand
115116
{
116117
PickPlayerCommand()
117118
{
118-
super("pick", "Picks one player FROM SPECTATORS to your team and passes an opportunity to pick to next Team Leader");
119+
super("pick", Descriptions::pickcomtext);
119120
SetUsage("<username>");
120121
}
121122

@@ -164,7 +165,7 @@ class ApproveTeamsCommand : ChatCommand
164165
{
165166
ApproveTeamsCommand()
166167
{
167-
super("lock", "Ends picking process by approving team personnel");
168+
super("lock", Descriptions::lockcomtext);
168169
}
169170

170171
bool canPlayerExecute(CPlayer@ player)
@@ -187,24 +188,10 @@ class ApproveTeamsCommand : ChatCommand
187188
approved_teams.ClearLists();
188189
if (!was_locked) {
189190
approved_teams.FormLists();
190-
if (g_locale == "ru")
191-
{
192-
server_AddToChat("Команды сформированы", SColor(0xff474ac6));
193-
}
194-
else
195-
{
196-
server_AddToChat("Teams locked", SColor(0xff474ac6));
197-
}
191+
server_AddToChat(Descriptions::lockcomchatloc, SColor(0xff474ac6));
198192
}
199193
else
200-
if (g_locale == "ru")
201-
{
202-
server_AddToChat("Команды расформированы", SColor(0xff474ac6));
203-
}
204-
else
205-
{
206-
server_AddToChat("Teams unlocked", SColor(0xff474ac6));
207-
}
194+
server_AddToChat(Descriptions::lockcomchatunl, SColor(0xff474ac6));
208195

209196
approved_teams.PrintMembers();
210197
rules.set("approved_teams", @approved_teams);
@@ -215,7 +202,7 @@ class SetBuilderLimitCommand : ChatCommand
215202
{
216203
SetBuilderLimitCommand()
217204
{
218-
super("blim", "Limits count of builders for every team");
205+
super("blim", Descriptions::builderlimtext);
219206
SetUsage("<builder limit>");
220207
}
221208

@@ -240,15 +227,15 @@ class SetBuilderLimitCommand : ChatCommand
240227

241228
rules.set_u8("builders_limit", parseInt(args[0]));
242229

243-
if (isServer()) server_AddToChat("Максимум строителей теперь "+args[0], SColor(0xff474ac6));
230+
if (isServer()) server_AddToChat(Descriptions::builderlimchat +args[0], SColor(0xff474ac6));
244231
}
245232
}
246233

247234
class SetArcherLimitCommand : ChatCommand
248235
{
249236
SetArcherLimitCommand()
250237
{
251-
super("alim", "Limits count of archers for every team");
238+
super("alim", Descriptions::archerlimtext);
252239
SetUsage("<archer limit>");
253240
}
254241

@@ -273,15 +260,15 @@ class SetArcherLimitCommand : ChatCommand
273260

274261
rules.set_u8("archers_limit", parseInt(args[0]));
275262

276-
if (isServer()) server_AddToChat("Максимум лучников теперь "+args[0], SColor(0xff474ac6));
263+
if (isServer()) server_AddToChat(Descriptions::archerlimchat +args[0], SColor(0xff474ac6));
277264
}
278265
}
279266

280267
class ToggleClassChangingOnShops : ChatCommand
281268
{
282269
ToggleClassChangingOnShops()
283270
{
284-
super("togglechclass", "Disallowing class changing on shops");
271+
super("togglechclass", Descriptions::togglechcomtext);
285272
}
286273

287274
bool canPlayerExecute(CPlayer@ player)
@@ -298,19 +285,19 @@ class ToggleClassChangingOnShops : ChatCommand
298285
bool isEnable = rules.get_bool("no_class_change_on_shop");
299286
rules.set_bool("no_class_change_on_shop", !isEnable);
300287
//printf("Boolean no_class_change_on_shop is " + rules.get_bool("no_class_change_on_shop"));
301-
string isEnableStr = "включена";
288+
string isEnableStr = Descriptions::togglechcom2;
302289
if(!isEnable) {
303-
isEnableStr = "выключена";
290+
isEnableStr = Descriptions::togglechcom3;
304291
}
305-
if (isServer()) server_AddToChat("Смена классов теперь "+isEnableStr, SColor(0xff474ac6));
292+
if (isServer()) server_AddToChat(Descriptions::togglechcomchat +isEnableStr, SColor(0xff474ac6));
306293
}
307294
}
308295

309296
class BindingsMenu : ChatCommand
310297
{
311298
BindingsMenu()
312299
{
313-
super("bindings", "Show mod bindings menu");
300+
super("bindings", Descriptions::bindingscom);
314301
}
315302

316303
bool canPlayerExecute(CPlayer@ player)
@@ -335,4 +322,4 @@ class BindingsMenu : ChatCommand
335322

336323
//printf("Boolean no_class_change_on_shop is " + rules.get_bool("no_class_change_on_shop"));
337324
}
338-
}
325+
}

ChangedScripts/Includes/Descriptions.as

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
// cannot be changed after-the-fact.
77
// It's good for performance to just translate once though.
88

9+
#include "TranslationsSystem.as"
10+
911
namespace Descriptions
1012
{
1113
const string
@@ -88,7 +90,7 @@ namespace Descriptions
8890
meal = getTranslatedString("A hearty meal to get you back on your feet."),
8991
egg = getTranslatedString("A suspiciously undercooked egg, maybe it will hatch."),
9092
burger = getTranslatedString("A burger to go."),
91-
pear = "A juicy and sweet pear.",
93+
pear = Descriptions::peartext,
9294

9395
//Magic Scrolls
9496
scroll_carnage = getTranslatedString("This magic scroll when cast will turn all nearby enemies into a pile of bloody gibs."),

ChangedScripts/ScoreboardRender.as

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "ApprovedTeams.as";
55
#include "RunnerHead.as";
66
#include "pathway.as";
7+
#include "TranslationsSystem.as";
78
//#include "RulesCore"
89

910
CPlayer@ hoveredPlayer;
@@ -958,7 +959,7 @@ void onRenderScoreboard(CRules@ this)
958959
ScoreboardField(
959960
Vec2f(screenWidth - tl.x - 200, 115 - scrollOffset),
960961
Vec2f(screenWidth - tl.x, 115 - scrollOffset + 40),
961-
"Current version: " + mod_version
962+
Descriptions::currentversiontext + mod_version
962963
);
963964
LinkButton(
964965
Vec2f(screenWidth - tl.x - 275, 115 - scrollOffset),

Characters/Accolades.as

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "pathway.as"
2+
#include "TranslationsSystem.as"
23
///////////////////////////////////////////////////////////////////////////////
34
//
45
// Accolades system
@@ -257,5 +258,5 @@ string[] accolade_description = {
257258
"Map Contributor - for contributing to the official map cycle",
258259
"Moderation Contributor - for contributing to moderating the game, forums, or discord",
259260
"Gold Member - for enjoying the game with us since before the F2P launch",
260-
"Контрибьютор Груши - за разработку мода Grusha CTF"
261+
Descriptions::goldgrushatext
261262
};

Entities/Common/Respawning/ClassSelectMenu.as

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//stuff for building respawn menus
22

33
#include "RespawnCommandCommon.as"
4+
#include "TranslationsSystem.as"
45

56
//class for getting everything needed for swapping to a class at a building
67

@@ -82,14 +83,8 @@ void addClassesToMenu(CBlob@ this, CGridMenu@ menu, u16 callerID)
8283
}
8384
else if (P_Archers >= archers_limit)
8485
{
85-
if (g_locale == "ru")
86-
{
87-
button.SetHoverText( " " + "Всего " + P_Archers + " / " + archers_limit + "\n");
88-
}
89-
else
90-
{
91-
button.SetHoverText( " " + "Total " + P_Archers + " / " + archers_limit + "\n");
92-
}
86+
button.SetHoverText( " " + Descriptions::totaltext + P_Archers + " / " + archers_limit + "\n");
87+
9388
button.SetEnabled(false);
9489
}
9590
}
@@ -101,14 +96,8 @@ void addClassesToMenu(CBlob@ this, CGridMenu@ menu, u16 callerID)
10196
}
10297
else if (P_Builders >= builders_limit && !rules.isWarmup())
10398
{
104-
if (g_locale == "ru")
105-
{
106-
button.SetHoverText( " " + "Всего " + P_Builders + " / " + builders_limit + "\n");
107-
}
108-
else
109-
{
110-
button.SetHoverText( " " + "Total " + P_Builders + " / " + builders_limit + "\n");
111-
}
99+
button.SetHoverText( " " + Descriptions::totaltext + P_Builders + " / " + builders_limit + "\n");
100+
112101
button.SetEnabled(false);
113102
}
114103
}

Industry/CTFShops/Quarters/Quarters.as

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "CheckSpam.as"
88
#include "StandardControlsCommon.as"
99
#include "GenericButtonCommon.as"
10+
#include "TranslationsSystem.as"
1011

1112
const f32 beer_amount = 1.0f;
1213
const f32 heal_amount = 0.25f;
@@ -93,13 +94,13 @@ void onInit(CBlob@ this)
9394
this.set_u8("shop icon", 25);
9495

9596
{
96-
ShopItem@ s = addShopItem(this, "Beer - 1 Heart", "$quarters_beer$", "beer", Descriptions::beer, false);
97+
ShopItem@ s = addShopItem(this, Names::beeritem, "$quarters_beer$", "beer", Descriptions::beer, false);
9798
s.spawnNothing = true;
9899
AddRequirement(s.requirements, "coin", "", "Coins", CTFCosts::beer);
99100
AddHurtRequirement(s.requirements);
100101
}
101102
{
102-
ShopItem@ s = addShopItem(this, "Meal - Full Health", "$quarters_meal$", "meal", Descriptions::meal, false);
103+
ShopItem@ s = addShopItem(this, Names::mealitem, "$quarters_meal$", "meal", Descriptions::meal, false);
103104
s.spawnNothing = true;
104105
s.customButton = true;
105106
s.buttonwidth = 2;
@@ -108,15 +109,15 @@ void onInit(CBlob@ this)
108109
AddHurtRequirement(s.requirements);
109110
}
110111
{
111-
ShopItem@ s = addShopItem(this, "Egg - Full Health", "$quarters_egg$", "egg", Descriptions::egg, false);
112+
ShopItem@ s = addShopItem(this, Names::eggitem, "$quarters_egg$", "egg", Descriptions::egg, false);
112113
AddRequirement(s.requirements, "coin", "", "Coins", CTFCosts::egg);
113114
}
114115
{
115-
ShopItem@ s = addShopItem(this, "Burger - Full Health", "$quarters_burger$", "food", Descriptions::burger, true);
116+
ShopItem@ s = addShopItem(this, Names::burgeritem, "$quarters_burger$", "food", Descriptions::burger, true);
116117
AddRequirement(s.requirements, "coin", "", "Coins", CTFCosts::burger);
117118
}
118119
{
119-
ShopItem@ s = addShopItem(this, "Pear - Semi-full Health", "$quarters_pear$", "pear", Descriptions::pear, true);
120+
ShopItem@ s = addShopItem(this, Names::pearitem, "$quarters_pear$", "pear", Descriptions::pear, true);
120121
AddRequirement(s.requirements, "coin", "", "Coins", CTFCosts::pear);
121122
}
122123
}

Scripts/Emotes/EmoteMenu.as

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,11 @@ void onTick(CRules@ rules)
5959

6060
WheelMenu@ menu = get_wheel_menu("emotes");
6161

62-
63-
if (b_KeyJustPressed("emote_wheel"))
62+
if (blob.isKeyJustPressed(key_bubbles))
6463
{
6564
set_active_wheel_menu(@menu);
6665
}
67-
else if (b_KeyJustReleased("emote_wheel") && get_active_wheel_menu() is menu)
66+
else if (blob.isKeyJustReleased(key_bubbles) && get_active_wheel_menu() is menu)
6867
{
6968
WheelMenuEntry@ selected = menu.get_selected();
7069
set_emote(blob, (selected !is null ? selected.name : ""));

0 commit comments

Comments
 (0)