Make engine chat syntax translatable
authorWuzzy <Wuzzy2@mail.ru>
Tue, 21 Aug 2018 15:46:34 +0200
changeset 13679 3f6fae745f84
parent 13678 1aa5e884326a
child 13680 d3a4cbba060e
Make engine chat syntax translatable The message syntax you see when someone uses chat, e.g. - Player 1: message - [Team]: message - [hedgehog name]: message
hedgewars/uChat.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uScript.pas
hedgewars/uTypes.pas
share/hedgewars/Data/Locale/en.txt
--- a/hedgewars/uChat.pas	Tue Aug 21 02:14:15 2018 +0200
+++ b/hedgewars/uChat.pas	Tue Aug 21 15:46:34 2018 +0200
@@ -35,7 +35,7 @@
 procedure TextInput(var event: TSDL_TextInputEvent);
 
 implementation
-uses uInputHandler, uTypes, uVariables, uCommands, uUtils, uTextures, uRender, uIO, uScript, uRenderUtils;
+uses uInputHandler, uTypes, uVariables, uCommands, uUtils, uTextures, uRender, uIO, uScript, uRenderUtils, uLocale;
 
 const MaxStrIndex = 27;
       MaxInputStrLen = 200;
@@ -1113,7 +1113,7 @@
     if copy(s, 1, 4) = '/me ' then
         s:= #2 + '* ' + UserNick + ' ' + copy(s, 5, Length(s) - 4)
     else
-        s:= #1 + UserNick + ': ' + s;
+        s:= #1 + Format(trmsg[sidChat], [UserNick, s]);
 
     AddChatString(s)
 end;
@@ -1122,7 +1122,7 @@
 begin
     SendIPC('b' + s);
 
-    s:= #4 + '[Team] ' + UserNick + ': ' + s;
+    s:= #4 + Format(trmsg[sidChatTeam], [UserNick, s]);
 
     AddChatString(s)
 end;
--- a/hedgewars/uGearsHedgehog.pas	Tue Aug 21 02:14:15 2018 +0200
+++ b/hedgewars/uGearsHedgehog.pas	Tue Aug 21 15:46:34 2018 +0200
@@ -579,7 +579,7 @@
                     speech^.Text:= SpeechText;
                     speech^.Hedgehog:= Gear^.Hedgehog;
                     speech^.FrameTicks:= SpeechType;
-                    AddChatString(#9+'[' + Gear^.Hedgehog^.Name + '] '+SpeechText);
+                    AddChatString(#9+FormatA(trmsg[sidChatHog], [Gear^.Hedgehog^.Name, SpeechText]));
                     end;
                 SpeechText:= ''
                 end;
--- a/hedgewars/uScript.pas	Tue Aug 21 02:14:15 2018 +0200
+++ b/hedgewars/uScript.pas	Tue Aug 21 15:46:34 2018 +0200
@@ -86,6 +86,7 @@
     uVisualGearsList,
     uGearsHandlersMess,
     uPhysFSLayer,
+    uLocale,
     SDLh
 {$IFNDEF PAS2C}
     , typinfo
@@ -1628,7 +1629,7 @@
                vgear^.Text:= lua_tostring(L, 2);
                if Gear^.Kind = gtHedgehog then
                    begin
-                   AddChatString(#9+'[' + gear^.Hedgehog^.Name + '] '+vgear^.text);
+                   AddChatString(#9+FormatA(trmsg[sidChatHog], [gear^.Hedgehog^.Name, vgear^.text]));
                    vgear^.Hedgehog:= gear^.Hedgehog
                    end
                else vgear^.Frame:= gear^.uid;
--- a/hedgewars/uTypes.pas	Tue Aug 21 02:14:15 2018 +0200
+++ b/hedgewars/uTypes.pas	Tue Aug 21 15:46:34 2018 +0200
@@ -481,7 +481,7 @@
             sidWinner2, sidWinner3, sidWinner4, sidWinner5, sidWinner6,
             sidWinner7, sidWinnerAll, sidTeamGone, sidTeamBack, sidAutoSkip,
             sidFPS, sidLuaParsingOff, sidLuaParsingOn, sidLuaParsingDenied,
-            sidAmmoCount);
+            sidAmmoCount, sidChat, sidChatTeam, sidChatHog);
 
     TCmdHelpStrId = (
             sidCmdHeaderBasic, sidCmdTogglechat, sidCmdTeam, sidCmdMe,
--- a/share/hedgewars/Data/Locale/en.txt	Tue Aug 21 02:14:15 2018 +0200
+++ b/share/hedgewars/Data/Locale/en.txt	Tue Aug 21 15:46:34 2018 +0200
@@ -110,6 +110,12 @@
 01:43=Lua parsing is not allowed in online games!
 ; Ammo count in ammo menu
 01:44=%1×
+; Chat. %1 = player, %2 = message
+01:45=%1: %2
+; Team chat. %1 = player, %2 = message
+01:46=[Team] %1: %2
+; Hedgehog chat. %1 = hog name, %2 = message
+01:47=[%1]: %2
 
 ; Event messages
 ; Normal hog (%1) died (0 health)