From 6b257de75a5eb31b56fae63911c025d3c1067c5c Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 30 Dec 2017 22:25:32 +0200 Subject: [PATCH] Add internationalization to basechat and fix CS:GO colours (#674) * Added translation more to basechat Also fixed colors, because it didn't work without `\x01` at begin of string. * Fixed cs:go colors, thanks Bara20 * Added 'space' at the start of string. * Added check for Engine_CSGO, to remove offset on other games * forgot one row --- plugins/basechat.sp | 22 +++++++++++++++++----- translations/common.phrases.txt | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/plugins/basechat.sp b/plugins/basechat.sp index 69cf3b68f..46dd1472e 100644 --- a/plugins/basechat.sp +++ b/plugins/basechat.sp @@ -334,7 +334,10 @@ void SendChatToAll(int client, const char[] message) } FormatActivitySource(client, i, nameBuf, sizeof(nameBuf)); - PrintToChat(i, "\x04(ALL) %s: \x01%s", nameBuf, message); + if (g_GameEngine == Engine_CSGO) + PrintToChat(i, " \x01\x0B\x04%t: \x01%s", "Say all", nameBuf, message); + else + PrintToChat(i, "\x04%t: \x01%s", "Say all", nameBuf, message); } } @@ -360,7 +363,10 @@ void SendChatToAdmins(int from, const char[] message) { if (IsClientInGame(i) && (from == i || CheckCommandAccess(i, "sm_chat", ADMFLAG_CHAT))) { - PrintToChat(i, "\x04(%sADMINS) %N: \x01%s", fromAdmin ? "" : "TO ", from, message); + if (g_GameEngine == Engine_CSGO) + PrintToChat(i, " \x01\x0B\x04%t: \x01%s", fromAdmin ? "Chat admins" : "Chat to admins", from, message); + else + PrintToChat(i, "\x04%t: \x01%s", fromAdmin ? "Chat admins" : "Chat to admins", from, message); } } } @@ -388,10 +394,16 @@ void SendPrivateChat(int client, int target, const char[] message) } else if (target != client) { - PrintToChat(client, "\x04(Private to %N) %N: \x01%s", target, client, message); + if (g_GameEngine == Engine_CSGO) + PrintToChat(client, " \x01\x0B\x04%t: \x01%s", "Private say to", target, client, message); + else + PrintToChat(client, "\x04%t: \x01%s", "Private say to", target, client, message); } - - PrintToChat(target, "\x04(Private to %N) %N: \x01%s", target, client, message); + + if (g_GameEngine == Engine_CSGO) + PrintToChat(target, " \x01\x0B\x04%t: \x01%s", "Private say to", target, client, message); + else + PrintToChat(target, "\x04%t: \x01%s", "Private say to", target, client, message); LogAction(client, target, "\"%L\" triggered sm_psay to \"%L\" (text %s)", client, target, message); } diff --git a/translations/common.phrases.txt b/translations/common.phrases.txt index a3d544fc9..ec950999c 100644 --- a/translations/common.phrases.txt +++ b/translations/common.phrases.txt @@ -239,4 +239,25 @@ { "en" "Off" } + + "Say all" + { + "#format" "{1:s}" + "en" "(ALL) {1}" + } + "Chat admins" + { + "#format" "{1:N}" + "en" "(ADMINS) {1}" + } + "Chat to admins" + { + "#format" "{1:N}" + "en" "(TO ADMINS) {1}" + } + "Private say to" + { + "#format" "{1:N},{2:N}" + "en" "(Private to {1}) {2}" + } }