Skip to content

Commit 1568d07

Browse files
authored
feat: add localization for no permission error messages & spanish language support. (#1099)
1 parent 55542db commit 1568d07

4 files changed

Lines changed: 42 additions & 6 deletions

File tree

configs/addons/counterstrikesharp/lang/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,9 @@
1919
"Target must be dead": "This command can only be used on dead players.",
2020
"Unable to target": "You cannot target this player.",
2121
"Cannot target bot": "Unable to perform this command on a bot.",
22-
"More than one client matched": "More than one client matched the given pattern."
22+
"More than one client matched": "More than one client matched the given pattern.",
23+
24+
"Missing permissions": "You are missing the correct permissions",
25+
"Missing one permission": "You do not have one of the correct permissions",
26+
"Command permission denied": "[CSS] {0} ({1}) to execute this command."
2327
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"menu.button.previous": "Anterior",
3+
"menu.button.next": "Siguiente",
4+
"menu.button.close": "Cerrar",
5+
6+
"all": "todos los jugadores",
7+
"bots": "bots",
8+
"humans": "humanos",
9+
"alive": "jugadores vivos",
10+
"dead": "jugadores muertos",
11+
"notme": "todos los jugadores excepto yo",
12+
"ct": "jugadores CT",
13+
"t": "jugadores T",
14+
"spec": "espectadores",
15+
16+
"No matching client": "No se encontró ningún cliente que coincida.",
17+
"No matching clients": "No se encontraron clientes que coincidan.",
18+
"Target must be alive": "Este comando solo puede usarse en jugadores vivos.",
19+
"Target must be dead": "Este comando solo puede usarse en jugadores muertos.",
20+
"Unable to target": "No puedes seleccionar a este jugador.",
21+
"Cannot target bot": "No se puede ejecutar este comando en un bot.",
22+
"More than one client matched": "Más de un cliente coincidió con el patrón dado.",
23+
24+
"Missing permissions": "No tienes los permisos correctos",
25+
"Missing one permission": "No tienes uno de los permisos correctos",
26+
"Command permission denied": "[CSS] {0} ({1}) para ejecutar este comando."
27+
}

configs/addons/counterstrikesharp/lang/tr.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,9 @@
1919
"Target must be dead": "{white}Bu komut yalnızca ölü oyunculara uygulanabilir.",
2020
"Unable to target": "{white}Bu oyuncu hedeflenemez.",
2121
"Cannot target bot": "{white}Bu komut bir bota uygulanamaz.",
22-
"More than one client matched": "{white}Verilen kalıba birden fazla istemci eşleşti."
22+
"More than one client matched": "{white}Verilen kalıba birden fazla istemci eşleşti.",
23+
24+
"Missing permissions": "{white}Doğru izinlere sahip değilsiniz",
25+
"Missing one permission": "{white}Doğru izinlerden birine sahip değilsiniz",
26+
"Command permission denied": "[CSS] {0} ({1}) bu komutu çalıştırmak için."
2327
}

managed/CounterStrikeSharp.API/Core/Commands/CommandManager.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private void HandleCommandInternal(int playerSlot, IntPtr commandInfo)
6565
var info = new CommandInfo(commandInfo, caller);
6666

6767
var name = info.GetArg(0).ToLower();
68-
68+
6969
using var temporaryCulture = new WithTemporaryCulture(caller.GetLanguage());
7070

7171
if (_commandDefinitions.TryGetValue(name, out var handler))
@@ -81,7 +81,7 @@ private void HandleCommandInternal(int playerSlot, IntPtr commandInfo)
8181

8282
// We do not need to do permission checks on commands executed from the server console.
8383
// The server will always be allowed to execute commands (unless marked as client only like above)
84-
if (caller != null)
84+
if (caller != null)
8585
{
8686
// Do not execute command if we do not have the correct permissions.
8787
var adminData = AdminManager.GetPlayerAdminData(caller!.AuthorizedSteamID);
@@ -120,11 +120,12 @@ private void HandleCommandInternal(int playerSlot, IntPtr commandInfo)
120120
if (!attr.CanExecuteCommand(caller))
121121
{
122122
var responseStr = (attr.GetType() == typeof(RequiresPermissions)) ?
123-
"You are missing the correct permissions" : "You do not have one of the correct permissions";
123+
Application.Localizer["Missing permissions"] :
124+
Application.Localizer["Missing one permission"];
124125

125126
var flags = attr.Permissions.Except(adminData?.GetAllFlags() ?? new HashSet<string>());
126127
flags = flags.Except(adminData?.Groups ?? new HashSet<string>());
127-
info.ReplyToCommand($"[CSS] {responseStr} ({string.Join(", ", flags)}) to execute this command.");
128+
info.ReplyToCommand(Application.Localizer["Command permission denied", responseStr, string.Join(", ", flags)]);
128129

129130
return;
130131
}

0 commit comments

Comments
 (0)