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")]
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.
/// </summary>
[DataField("name")]
public string Name { get; } = string.Empty;
public string Name
{
get => _name;
private set => _name = Loc.GetString(value);
}
/// <summary>
/// The description of this trait.
/// </summary>
[DataField("description")]
public string? Description { get; }
public string? Description
{
get => _description;
private set => _description = value is null ? null : Loc.GetString(value);
}
/// <summary>
/// Don't apply this trait to entities this whitelist IS NOT valid for.