From: Ed <96445749+TheShuEd@users.noreply.github.com> Date: Wed, 29 Jan 2025 13:23:34 +0000 (+0300) Subject: Fix RoleTimeRequirement localization (#34735) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=da75258f9f0002b1f25addec4c0581cba6a1a066;p=space-station-14.git Fix RoleTimeRequirement localization (#34735) * fix job restriction localization * Update Content.Shared/Roles/JobRequirement/RoleTimeRequirement.cs * Update Content.Shared/Roles/JobRequirement/RoleTimeRequirement.cs --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> --- diff --git a/Content.Shared/Roles/JobRequirement/RoleTimeRequirement.cs b/Content.Shared/Roles/JobRequirement/RoleTimeRequirement.cs index e75a18f011..f096cfcb42 100644 --- a/Content.Shared/Roles/JobRequirement/RoleTimeRequirement.cs +++ b/Content.Shared/Roles/JobRequirement/RoleTimeRequirement.cs @@ -40,13 +40,16 @@ public sealed partial class RoleTimeRequirement : JobRequirement 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(jobProto, out var indexedJob)) + return false; if (!Inverted) { @@ -56,7 +59,7 @@ public sealed partial class RoleTimeRequirement : JobRequirement reason = FormattedMessage.FromMarkupPermissive(Loc.GetString( "role-timer-role-insufficient", ("time", formattedRoleDiff), - ("job", Loc.GetString(proto)), + ("job", indexedJob.LocalizedName), ("departmentColor", departmentColor.ToHex()))); return false; } @@ -66,7 +69,7 @@ public sealed partial class RoleTimeRequirement : JobRequirement reason = FormattedMessage.FromMarkupPermissive(Loc.GetString( "role-timer-role-too-high", ("time", formattedRoleDiff), - ("job", Loc.GetString(proto)), + ("job", indexedJob.LocalizedName), ("departmentColor", departmentColor.ToHex()))); return false; } diff --git a/Resources/Locale/en-US/job/role-requirements.ftl b/Resources/Locale/en-US/job/role-requirements.ftl index 686fcb93cb..37265b875c 100644 --- a/Resources/Locale/en-US/job/role-requirements.ftl +++ b/Resources/Locale/en-US/job/role-requirements.ftl @@ -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)