From 58cb7121b048043375a216cb2035d5a749269e34 Mon Sep 17 00:00:00 2001 From: Morb <14136326+Morb0@users.noreply.github.com> Date: Wed, 9 Nov 2022 03:16:48 +0300 Subject: [PATCH] Localize traits (#11765) Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> --- Content.Shared/Traits/TraitPrototype.cs | 15 +++++++++++++-- Resources/Locale/en-US/traits/traits.ftl | 13 ++++++++++++- Resources/Prototypes/Traits/disabilities.yml | 10 +++++----- Resources/Prototypes/Traits/inconveniences.yml | 4 ++-- 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/Content.Shared/Traits/TraitPrototype.cs b/Content.Shared/Traits/TraitPrototype.cs index 1b3a73ce6b..2b872fc94a 100644 --- a/Content.Shared/Traits/TraitPrototype.cs +++ b/Content.Shared/Traits/TraitPrototype.cs @@ -10,6 +10,9 @@ namespace Content.Shared.Traits [Prototype("trait")] public sealed class TraitPrototype : IPrototype { + private string _name = string.Empty; + private string? _description; + [ViewVariables] [IdDataField] public string ID { get; } = default!; @@ -18,13 +21,21 @@ namespace Content.Shared.Traits /// The name of this trait. /// [DataField("name")] - public string Name { get; } = string.Empty; + public string Name + { + get => _name; + private set => _name = Loc.GetString(value); + } /// /// The description of this trait. /// [DataField("description")] - public string? Description { get; } + public string? Description + { + get => _description; + private set => _description = value is null ? null : Loc.GetString(value); + } /// /// Don't apply this trait to entities this whitelist IS NOT valid for. diff --git a/Resources/Locale/en-US/traits/traits.ftl b/Resources/Locale/en-US/traits/traits.ftl index 08df78b1ac..0700969aaf 100644 --- a/Resources/Locale/en-US/traits/traits.ftl +++ b/Resources/Locale/en-US/traits/traits.ftl @@ -1 +1,12 @@ -permanent-blindness-trait-examined = [color=lightblue]{CAPITALIZE(POSS-ADJ($target))} eyes are glassy and unfocused. It doesn't seem like {SUBJECT($target)} can see you.[/color] +trait-blindness-name = Blindness +trait-blindness-desc = You lack vision + +trait-narcolepsy-name = Narcolepsy +trait-narcolepsy-decs = You fall asleep randomly + +trait-pacifist-name = Pacifist + +trait-sneezing-name = Runny nose +trait-sneezing-desc = You sneeze and cough uncontrollably + +permanent-blindness-trait-examined = [color=lightblue]{CAPITALIZE(POSS-ADJ($target))} eyes are glassy and unfocused. It doesn't seem like {SUBJECT($target)} can see you.[/color] diff --git a/Resources/Prototypes/Traits/disabilities.yml b/Resources/Prototypes/Traits/disabilities.yml index 4746013445..c5ed02c946 100644 --- a/Resources/Prototypes/Traits/disabilities.yml +++ b/Resources/Prototypes/Traits/disabilities.yml @@ -1,7 +1,7 @@ - type: trait id: Blindness - name: Blindness - description: You lack vision + name: trait-blindness-name + description: trait-blindness-desc whitelist: components: - Blindable @@ -10,8 +10,8 @@ - type: trait id: Narcolepsy - name: Narcolepsy - description: You fall asleep randomly + name: trait-narcolepsy-name + description: trait-narcolepsy-decs components: - type: Narcolepsy timeBetweenIncidents: 300, 600 @@ -19,6 +19,6 @@ - type: trait id: Pacifist - name: Pacifist + name: trait-pacifist-name components: - type: Pacifist diff --git a/Resources/Prototypes/Traits/inconveniences.yml b/Resources/Prototypes/Traits/inconveniences.yml index 94368b1519..de25174c43 100644 --- a/Resources/Prototypes/Traits/inconveniences.yml +++ b/Resources/Prototypes/Traits/inconveniences.yml @@ -1,7 +1,7 @@ - type: trait id: UncontrollableSneezing - name: Runny nose - description: You sneeze and cough uncontrollably + name: trait-sneezing-name + description: trait-sneezing-desc whitelist: components: - DiseaseCarrier