Skip to content

Commit

Permalink
Fix RoleTimeRequirement localization (space-wizards#34735)
Browse files Browse the repository at this point in the history
* fix job restriction localization

* Update Content.Shared/Roles/JobRequirement/RoleTimeRequirement.cs

* Update Content.Shared/Roles/JobRequirement/RoleTimeRequirement.cs

---------

Co-authored-by: slarticodefast <[email protected]>
  • Loading branch information
TheShuEd and slarticodefast authored Jan 29, 2025
1 parent 467b686 commit da75258
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
19 changes: 11 additions & 8 deletions Content.Shared/Roles/JobRequirement/RoleTimeRequirement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ public override bool Check(IEntityManager entManager,
var formattedRoleDiff = ContentLocalizationManager.FormatPlaytime(roleDiffSpan);
var departmentColor = Color.Yellow;

if (entManager.EntitySysManager.TryGetEntitySystem(out SharedJobSystem? jobSystem))
{
var jobProto = jobSystem.GetJobPrototype(proto);
if (!entManager.EntitySysManager.TryGetEntitySystem(out SharedJobSystem? jobSystem))
return false;

if (jobSystem.TryGetDepartment(jobProto, out var departmentProto))
departmentColor = departmentProto.Color;
}
var jobProto = jobSystem.GetJobPrototype(proto);

if (jobSystem.TryGetDepartment(jobProto, out var departmentProto))
departmentColor = departmentProto.Color;

if (!protoManager.TryIndex<JobPrototype>(jobProto, out var indexedJob))
return false;

if (!Inverted)
{
Expand All @@ -56,7 +59,7 @@ public override bool Check(IEntityManager entManager,
reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
"role-timer-role-insufficient",
("time", formattedRoleDiff),
("job", Loc.GetString(proto)),
("job", indexedJob.LocalizedName),
("departmentColor", departmentColor.ToHex())));
return false;
}
Expand All @@ -66,7 +69,7 @@ public override bool Check(IEntityManager entManager,
reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
"role-timer-role-too-high",
("time", formattedRoleDiff),
("job", Loc.GetString(proto)),
("job", indexedJob.LocalizedName),
("departmentColor", departmentColor.ToHex())));
return false;
}
Expand Down
24 changes: 12 additions & 12 deletions Resources/Locale/en-US/job/role-requirements.ftl
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
role-timer-department-insufficient = You require [color=yellow]{$time}[/color] more playtime in the [color={$departmentColor}]{$department}[/color] department to play this role.
role-timer-department-too-high = You require [color=yellow]{$time}[/color] less playtime in the [color={$departmentColor}]{$department}[/color] department to play this role. (Are you trying to play a trainee role?)
role-timer-overall-insufficient = You require [color=yellow]{$time}[/color] more overall playtime to play this role.
role-timer-overall-too-high = You require [color=yellow]{$time}[/color] less overall playtime to play this role. (Are you trying to play a trainee role?)
role-timer-role-insufficient = You require [color=yellow]{$time}[/color] more playtime with [color={$departmentColor}]{$job}[/color] to play this role.
role-timer-role-too-high = You require[color=yellow] {$time}[/color] less playtime with [color={$departmentColor}]{$job}[/color] to play this role. (Are you trying to play a trainee role?)
role-timer-age-too-old = Your character must be under the age of [color=yellow]{$age}[/color] to play this role.
role-timer-age-too-young = Your character must be over the age of [color=yellow]{$age}[/color] to play this role.
role-timer-whitelisted-species = Your character must be one of the following species to play this role:
role-timer-blacklisted-species = Your character must not be one of the following species to play this role:
role-timer-whitelisted-traits = Your character must have one of the following traits:
role-timer-blacklisted-traits = Your character must not have any of the following traits:
role-timer-department-insufficient = You require [color=yellow]{$time}[/color] more playtime in the [color={$departmentColor}]{$department}[/color] department to unlock this.
role-timer-department-too-high = You require [color=yellow]{$time}[/color] less playtime in the [color={$departmentColor}]{$department}[/color] department to select this. (Are you trying to play a trainee role?)
role-timer-overall-insufficient = You require [color=yellow]{$time}[/color] more overall playtime to unlock this.
role-timer-overall-too-high = You require [color=yellow]{$time}[/color] less overall playtime to select this. (Are you trying to play a trainee role?)
role-timer-role-insufficient = You require [color=yellow]{$time}[/color] more playtime with [color={$departmentColor}]{$job}[/color] to unlock this.
role-timer-role-too-high = You require[color=yellow] {$time}[/color] less playtime with [color={$departmentColor}]{$job}[/color] to select this. (Are you trying to play a trainee role?)
role-timer-age-too-old = Your character must be under the age of [color=yellow]{$age}[/color] for you to choose this.
role-timer-age-too-young = Your character must be over the age of [color=yellow]{$age}[/color] for you to choose this.
role-timer-whitelisted-species = Your character must be one of the following species for you to select this:
role-timer-blacklisted-species = Your character must not be one of the following species for you to select this:
role-timer-whitelisted-traits = Your character must have one of the following traits for you to select this:
role-timer-blacklisted-traits = Your character must not have any of the following traits for you to select this:
role-timer-locked = Locked (hover for details)
Expand Down

0 comments on commit da75258

Please sign in to comment.