Skip to content

Commit

Permalink
impl prefix translations
Browse files Browse the repository at this point in the history
  • Loading branch information
destoer committed Feb 8, 2024
1 parent a287597 commit 57db5be
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 9 deletions.
10 changes: 9 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
"warden.give_freeday_cmd": "give_freeday",
"warden.give_pardon_cmd": "give_pardon",
"warden.colour_cmd": "colour",
"warden.warden_prefix": "{green}[Warden]: {white}",
"warden.door_prefix": "{green}[Door]: {white}",
"warden.team_prefix": "{green}[Team]: {white}",

"warden.give_pardon": "{0} has been pardoned",
"warden.give_freeday": "{0} has been given a freeday",
Expand All @@ -78,11 +81,14 @@
"mute.thirty": "All t's are muted for the first 30 seconds",
"mute.speak_quietly": "T's may now speak quietly",
"mute.end_round": "You are muted until the end of the round",
"mute.mute_prefix": "{green}[Mute]: {white}",

"warday.live": "Weapons live!",
"warday.location": "warday at {0}",
"warday.warday_prefix": "{green}[Warday]: {white}",

"rebel.kill": "{0} killed the rebel {1}",
"rebel.rebel_prefix": "{green}[Rebel]: {white}",

"block.enable": "Block enabled",
"block.disable": "Block disabled",
Expand Down Expand Up @@ -118,6 +124,7 @@
"sd.start_cmd": "sd",
"sd.start_ff_cmd": "sd_ff",
"sd.cancel_cmd": "sd_cancel",
"sd.sd_prefix": "{green}[Special Day]: {white}",


"lr.rebel_last": "You must be the last player alive to rebel",
Expand All @@ -137,5 +144,6 @@

"lr.cancel_lr_cmd": "cancel_lr",
"lr.start_lr_cmd": "lr",
"lr.stats_cmd": "lr_stats"
"lr.stats_cmd": "lr_stats",
"lr.lr_prefix": "{green}[LR]: {white}"
}
17 changes: 17 additions & 0 deletions src/Jail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ public override void Load(bool hotReload)

RegisterListeners();

LocalizePrefix();

JailPlayer.SetupDB();

Console.WriteLine("Sucessfully started JB");
Expand All @@ -205,6 +207,21 @@ public override void Load(bool hotReload)

}

void LocalizePrefix()
{
LastRequest.LR_PREFIX = Chat.Localize("lr.lr_prefix");
Entity.DOOR_PREFIX = Chat.Localize("warden.door_prefix");

SpecialDay.SPECIALDAY_PREFIX = Chat.Localize("sd.sd_prefix");
JailPlayer.REBEL_PREFIX = Chat.Localize("rebel.rebel_prefix");

Mute.MUTE_PREFIX = Chat.Localize("mute.mute_prefix");
Warden.TEAM_PREFIX = Chat.Localize("warden.team_prefix");

Warday.WARDAY_PREFIX = Chat.Localize("warday.warday_prefix");
Warden.WARDEN_PREFIX = Chat.Localize("warden.warden_prefix");
}

void StatDBReload()
{
Task.Run(async () =>
Expand Down
2 changes: 1 addition & 1 deletion src/LastRequest/LastRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -525,5 +525,5 @@ internal class LRChoice

long startTimestamp = 0;

public static readonly String LR_PREFIX = $" {ChatColors.Green}[LR]: {ChatColors.White}";
public static String LR_PREFIX = $" {ChatColors.Green}[LR]: {ChatColors.White}";
}
2 changes: 1 addition & 1 deletion src/Lib/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static public int DrawLaser(Vector start, Vector end, float width, Color colour)
return (int)laser.Index;
}

static String DOOR_PREFIX = $" {ChatColors.Green}[Door control]: {ChatColors.White}";
public static String DOOR_PREFIX = $" {ChatColors.Green}[Door control]: {ChatColors.White}";

public static void ForceClose()
{
Expand Down
2 changes: 1 addition & 1 deletion src/SpecialDay/SpecialDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public enum SDType
NONE
};

public static readonly String SPECIALDAY_PREFIX = $" {ChatColors.Green}[Special day]: {ChatColors.White}";
public static String SPECIALDAY_PREFIX = $" {ChatColors.Green}[Special day]: {ChatColors.White}";

static String[] SD_NAME = {
"Friendly fire",
Expand Down
2 changes: 1 addition & 1 deletion src/Warden/JailPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public void PlayerHurt(CCSPlayerController? player, CCSPlayerController? attacke
}


public static readonly String REBEL_PREFIX = $" {ChatColors.Green}[REBEL]: {ChatColors.White}";
public static String REBEL_PREFIX = $" {ChatColors.Green}[REBEL]: {ChatColors.White}";

public static JailConfig Config = new JailConfig();

Expand Down
2 changes: 1 addition & 1 deletion src/Warden/Mute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public void SwitchTeam(CCSPlayerController? player,int new_team)

CSTimer.Timer? muteTimer = null;

static readonly String MUTE_PREFIX = $" {ChatColors.Green}[MUTE]: {ChatColors.White}";
public static String MUTE_PREFIX = $" {ChatColors.Green}[MUTE]: {ChatColors.White}";

// has the mute timer finished?
bool muteActive = false;
Expand Down
2 changes: 1 addition & 1 deletion src/Warden/Team.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

public partial class Warden
{
static readonly String TEAM_PREFIX = $" {ChatColors.Green}[TEAM]: {ChatColors.White}";
public static String TEAM_PREFIX = $" {ChatColors.Green}[TEAM]: {ChatColors.White}";

public bool JoinTeam(CCSPlayerController? invoke, CommandInfo command)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Warden/Warday.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void MapStart()

public JailConfig Config = new JailConfig();

String WARDAY_PREFIX = $" {ChatColors.Green} [Warday]: {ChatColors.White}";
public static String WARDAY_PREFIX = $" {ChatColors.Green} [Warday]: {ChatColors.White}";

bool wardayActive = false;

Expand Down
2 changes: 1 addition & 1 deletion src/Warden/Warden.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public void SetupPlayerGuns(CCSPlayerController? player)

int wardenSlot = INAVLID_SLOT;

public static readonly String WARDEN_PREFIX = $" {ChatColors.Green}[WARDEN]: {ChatColors.White}";
public static String WARDEN_PREFIX = $" {ChatColors.Green}[WARDEN]: {ChatColors.White}";

long wardenTimestamp = -1;

Expand Down

0 comments on commit 57db5be

Please sign in to comment.