Localize traits (#11765)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Morb
2022-11-09 03:16:48 +03:00
committed by GitHub
parent 9f842c9c37
commit 58cb7121b0
4 changed files with 32 additions and 10 deletions

View File

@@ -10,6 +10,9 @@ namespace Content.Shared.Traits
[Prototype("trait")] [Prototype("trait")]
public sealed class TraitPrototype : IPrototype public sealed class TraitPrototype : IPrototype
{ {
private string _name = string.Empty;
private string? _description;
[ViewVariables] [ViewVariables]
[IdDataField] [IdDataField]
public string ID { get; } = default!; public string ID { get; } = default!;
@@ -18,13 +21,21 @@ namespace Content.Shared.Traits
/// The name of this trait. /// The name of this trait.
/// </summary> /// </summary>
[DataField("name")] [DataField("name")]
public string Name { get; } = string.Empty; public string Name
{
get => _name;
private set => _name = Loc.GetString(value);
}
/// <summary> /// <summary>
/// The description of this trait. /// The description of this trait.
/// </summary> /// </summary>
[DataField("description")] [DataField("description")]
public string? Description { get; } public string? Description
{
get => _description;
private set => _description = value is null ? null : Loc.GetString(value);
}
/// <summary> /// <summary>
/// Don't apply this trait to entities this whitelist IS NOT valid for. /// Don't apply this trait to entities this whitelist IS NOT valid for.

View File

@@ -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]

View File

@@ -1,7 +1,7 @@
- type: trait - type: trait
id: Blindness id: Blindness
name: Blindness name: trait-blindness-name
description: You lack vision description: trait-blindness-desc
whitelist: whitelist:
components: components:
- Blindable - Blindable
@@ -10,8 +10,8 @@
- type: trait - type: trait
id: Narcolepsy id: Narcolepsy
name: Narcolepsy name: trait-narcolepsy-name
description: You fall asleep randomly description: trait-narcolepsy-decs
components: components:
- type: Narcolepsy - type: Narcolepsy
timeBetweenIncidents: 300, 600 timeBetweenIncidents: 300, 600
@@ -19,6 +19,6 @@
- type: trait - type: trait
id: Pacifist id: Pacifist
name: Pacifist name: trait-pacifist-name
components: components:
- type: Pacifist - type: Pacifist

View File

@@ -1,7 +1,7 @@
- type: trait - type: trait
id: UncontrollableSneezing id: UncontrollableSneezing
name: Runny nose name: trait-sneezing-name
description: You sneeze and cough uncontrollably description: trait-sneezing-desc
whitelist: whitelist:
components: components:
- DiseaseCarrier - DiseaseCarrier