Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(translations): front-facing message translations #605

Merged
merged 4 commits into from
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 30 additions & 26 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# =========================
# Operating System Files
# =========================
# OSX
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon
Icon


# Thumbnails
._*
Expand All @@ -48,6 +49,9 @@ Temporary Items
# SourceBans++
/web/config.php
/web/cache/*.php
/web/cache/*.tmp
/web/cache/sessions/sess_*
/web/cache/*.tmp
/web/cache/sessions/sess_*
*.smx

# VSCode
.vscode
114 changes: 58 additions & 56 deletions game/addons/sourcemod/scripting/sbpp_main.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,8 @@ public void VerifyInsert(Database db, DBResultSet results, const char[] error, D
{
if (dataPack == INVALID_HANDLE)
{
LogToFile(logFile, "Ban Failed: %s", error);
LogToFile(logFile, "%t: %s", "Ban Fail", error);

return;
}

Expand Down Expand Up @@ -1161,20 +1162,20 @@ public void VerifyInsert(Database db, DBResultSet results, const char[] error, D
{
if (Reason[0] == '\0')
{
ShowActivityEx(admin, Prefix, "%t", "Permabanned player", Name);
ShowActivityEx(admin, Prefix, "%t", "Permabanned Player", Name);
} else {
ShowActivityEx(admin, Prefix, "%t", "Permabanned player reason", Name, Reason);
ShowActivityEx(admin, Prefix, "%t", "Permabanned Player Reason", Name, Reason);
}
} else {
if (Reason[0] == '\0')
{
ShowActivityEx(admin, Prefix, "%t", "Banned player", Name, time);
ShowActivityEx(admin, Prefix, "%t", "Banned Player", Name, time);
} else {
ShowActivityEx(admin, Prefix, "%t", "Banned player reason", Name, time, Reason);
ShowActivityEx(admin, Prefix, "%t", "Banned Player Reason", Name, time, Reason);
}
}

LogAction(admin, client, "\"%L\" banned \"%L\" (minutes \"%d\") (reason \"%s\")", admin, client, time, Reason);
LogAction(admin, client, "%t", "Ban Log", admin, client, time, Reason);

if (PlayerDataPack[admin] != INVALID_HANDLE)
{
Expand All @@ -1187,9 +1188,10 @@ public void VerifyInsert(Database db, DBResultSet results, const char[] error, D
{
char length[32];
if(time == 0)
FormatEx(length, sizeof(length), "permament");
FormatEx(length, sizeof(length), "%t", "permanent");
else
FormatEx(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes");
FormatEx(length, sizeof(length), "%d %t", time, time == 1 ? "minute" : "minutes");

KickClient(client, "%t\n\n%t", "Banned Check Site", WebsiteAddress, "Kick Reason", admin, Reason, length);
}
}
Expand All @@ -1213,17 +1215,19 @@ public void SelectBanIpCallback(Database db, DBResultSet results, const char[] e
{
LogToFile(logFile, "Ban IP Select Query Failed: %s", error);
if (admin && IsClientInGame(admin))
PrintToChat(admin, "%sFailed to ban %s.", Prefix, ip);
PrintToChat(admin, "%s%t", Prefix, "Ban Fail");
else
PrintToServer("%sFailed to ban %s.", Prefix, ip);
PrintToServer("%s%t", Prefix, "Ban Fail");

return;
}
if (results.RowCount)
{
if (admin && IsClientInGame(admin))
PrintToChat(admin, "%s%s is already banned.", Prefix, ip);
PrintToChat(admin, "%s%t", Prefix, "Already Banned", ip);
else
PrintToServer("%s%s is already banned.", Prefix, ip);
PrintToServer("%s%t", Prefix, "Already Banned", ip);

return;
}
if (serverID == -1)
Expand Down Expand Up @@ -1271,17 +1275,12 @@ public void InsertBanIpCallback(Database db, DBResultSet results, const char[] e
return;
}

LogAction(admin,
-1,
"\"%L\" added ban (minutes \"%d\") (ip \"%s\") (reason \"%s\")",
admin,
minutes,
arg,
reason);
LogAction(admin, -1, "%t", "Ban Added", admin, minutes, arg, reason);

if (admin && IsClientInGame(admin))
PrintToChat(admin, "%s%s successfully banned", Prefix, arg);
PrintToChat(admin, "%s%t", Prefix, "Ban Success Name", arg);
else
PrintToServer("%s%s successfully banned", Prefix, arg);
PrintToServer("%s%t", Prefix, "Ban Success Name", arg);
}

public void SelectUnbanCallback(Database db, DBResultSet results, const char[] error, DataPack dataPack)
Expand Down Expand Up @@ -1314,12 +1313,12 @@ public void SelectUnbanCallback(Database db, DBResultSet results, const char[] e
if (!results.RowCount)
{
if (admin && IsClientInGame(admin))
{
PrintToChat(admin, "%sNo active bans found for that filter", Prefix);
} else {
PrintToServer("%sNo active bans found for that filter", Prefix);
}
PrintToChat(admin, "%s%t", Prefix, "No Active Ban");
else
PrintToServer("%s%t", Prefix, "No Active Ban");

delete dataPack;

return;
}

Expand Down Expand Up @@ -1368,13 +1367,12 @@ public void InsertUnbanCallback(Database db, DBResultSet results, const char[] e
return;
}

LogAction(admin, -1, "\"%L\" removed ban (filter \"%s\") (reason \"%s\")", admin, arg, reason);
LogAction(admin, -1, "%t", "Ban Removed", admin, arg, reason);

if (admin && IsClientInGame(admin))
{
PrintToChat(admin, "%s%s successfully unbanned", Prefix, arg);
} else {
PrintToServer("%s%s successfully unbanned", Prefix, arg);
}
PrintToChat(admin, "%s%t", Prefix, "Unban Success Name", arg);
else
PrintToServer("%s%t", Prefix, "Unban Success Name", arg);
}

public void SelectAddbanCallback(Database db, DBResultSet results, const char[] error, DataPack dataPack)
Expand All @@ -1395,18 +1393,21 @@ public void SelectAddbanCallback(Database db, DBResultSet results, const char[]
if (results == null)
{
LogToFile(logFile, "Add Ban Select Query Failed: %s", error);

if (admin && IsClientInGame(admin))
PrintToChat(admin, "%sFailed to ban %s.", Prefix, authid);
PrintToChat(admin, "%s%t", Prefix, "Ban Fail");
else
PrintToServer("%sFailed to ban %s.", Prefix, authid);
PrintToServer("%s%t", Prefix, "Ban Fail");

return;
}
if (results.RowCount)
{
if (admin && IsClientInGame(admin))
PrintToChat(admin, "%s%s is already banned.", Prefix, authid);
PrintToChat(admin, "%s%t", Prefix, "Already Banned", authid);
else
PrintToServer("%s%s is already banned.", Prefix, authid);
PrintToServer("%s%t", Prefix, "Already Banned", authid);

return;
}
if (serverID == -1)
Expand Down Expand Up @@ -1449,19 +1450,12 @@ public void InsertAddbanCallback(Database db, DBResultSet results, const char[]
return;
}

LogAction(admin,
-1,
"\"%L\" added ban (minutes \"%i\") (id \"%s\") (reason \"%s\")",
admin,
minutes,
authid,
reason);
LogAction(admin, -1, "%t", "Ban Added", admin, minutes, authid, reason);

if (admin && IsClientInGame(admin))
{
PrintToChat(admin, "%s%s successfully banned", Prefix, authid);
} else {
PrintToServer("%s%s successfully banned", Prefix, authid);
}
PrintToChat(admin, "%s%t", Prefix, "Ban Success Name", authid);
else
PrintToServer("%s%t", Prefix, "Ban Success Name", authid);
}

// ProcessQueueCallback is called as the result of selecting all the rows from the queue table
Expand Down Expand Up @@ -2625,40 +2619,48 @@ stock void PrepareBan(int client, int target, int time, char[] reason, int size)
#if defined DEBUG
LogToFile(logFile, "PrepareBan()");
#endif

if (!target || !IsClientInGame(target))
return;

char authid[64], name[32], bannedSite[512];

if (!GetClientAuthId(target, AuthId_Steam2, authid, sizeof(authid)))
return;
GetClientName(target, name, sizeof(name));

GetClientName(target, name, sizeof(name));

if (CreateBan(client, target, time, reason))
{
if (!time)
{
if (reason[0] == '\0')
{
ShowActivity(client, "%t", "Permabanned player", name);
ShowActivity(client, "%t", "Permabanned Player", name);
} else {
ShowActivity(client, "%t", "Permabanned player reason", name, reason);
ShowActivity(client, "%t", "Permabanned Player Reason", name, reason);
}
} else {
if (reason[0] == '\0')
{
ShowActivity(client, "%t", "Banned player", name, time);
ShowActivity(client, "%t", "Banned Player", name, time);
} else {
ShowActivity(client, "%t", "Banned player reason", name, time, reason);
ShowActivity(client, "%t", "Banned Player Reason", name, time, reason);
}
}
LogAction(client, target, "\"%L\" banned \"%L\" (minutes \"%d\") (reason \"%s\")", client, target, time, reason);

LogAction(client, target, "%t", "Ban Log", client, target, time, reason);

char length[32];

if(time == 0)
FormatEx(length, sizeof(length), "permament");
FormatEx(length, sizeof(length), "%t", "permanent");
else
FormatEx(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes");
FormatEx(length, sizeof(length), "%d %t", time, time == 1 ? "minute" : "minutes");

if (time > 5 || time == 0)
time = 5;

Format(bannedSite, sizeof(bannedSite), "%t\n\n%t", "Banned Check Site", WebsiteAddress, "Kick Reason", client, reason, length);//temp
BanClient(target, time, BANFLAG_AUTO, bannedSite, bannedSite, "sm_ban", client);
}
Expand Down
66 changes: 66 additions & 0 deletions game/addons/sourcemod/translations/sbpp_main.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,70 @@
"de" "Administrator: {1}\nGrund: {2}\nDauer: {3}"
"tr" "Yönetici: {1}\nSebep: {2}\nSüre: {3}"
}
"Permabanned Player"
{
"#format" "{1:s}"
"en" "Permanently banned {1}"
}
"Permabanned Player Reason"
{
"#format" "{1:s},{2:s}"
"en" "Permanently banned {1}. Reason: {2}"
}
"Banned Player"
{
"#format" "{1:s},{2:d}"
"en" "Banned {1} for {2} minutes"
}
"Banned Player Reason"
{
"#format" "{1:s},{2:d},{3:s}"
"en" "Banned {1} for {2} minutes. Reason: {3}"
}
"permanent"
{
"en" "permanent"
}
"minute"
{
"en" "minute"
}
"minutes"
{
"en" "minutes"
}
"Ban Log"
{
"#format" "{1:L},{2:L},{3:d},{4:s}"
"en" "\"{1}\" banned \"{2}\" (minutes: {3}) (reason: {4})
}
"Ban Added"
{
"#format" "{1:L},{2:d},{3:s},{4:s}"
"en" "\"{1}\" added ban (minutes: {2}) (id/ip: {3}) (reason: {4})"
}
"Ban Success Name"
{
"#format" "{1:s}"
"en" "Successfully banned {1}"
}
"Unban Success Name"
{
"#format" "{1:s}"
"en" "Successfully unbanned {1}"
}
"Already Banned"
{
"#format" "{1:s}"
"en" "{1} is already banned"
}
"Ban Removed"
{
"#format" "{1:L},{2:s},{3:s}"
"en" "\"{1}\" removed ban (filter: {2}) (reason: {3})"
}
"No Active Ban"
{
"en" "No active ban found"
}
}