Make RandomMetadata properly support localization (#36343)

* Make _outputSegments readonly

* Remove mystery character

* Use Fluent instead of string concatenation

* Adjust format

* Convert existing content

* Don't need these anymore

* Docs
This commit is contained in:
Tayrtahn
2025-04-06 14:12:39 -04:00
committed by GitHub
parent e88371b23b
commit 8d8c1e4dae
17 changed files with 83 additions and 54 deletions

View File

@@ -1,7 +1,7 @@
using Content.Shared.Dataset;
using Robust.Shared.Prototypes;
namespace Content.Server.RandomMetadata;
namespace Content.Server.RandomMetadata;
/// <summary>
/// Randomizes the description and/or the name for an entity by creating it from list of dataset prototypes or strings.
@@ -15,9 +15,17 @@ public sealed partial class RandomMetadataComponent : Component
[DataField]
public List<ProtoId<LocalizedDatasetPrototype>>? NameSegments;
/// <summary>
/// LocId of the formatting string to use to assemble the <see cref="NameSegments"/> into the entity's name.
/// Segments will be passed to the localization system with this string as variables named $part0, $part1, $part2, etc.
/// </summary>
[DataField]
public string NameSeparator = " ";
public LocId NameFormat = "random-metadata-name-format-default";
/// <summary>
/// LocId of the formatting string to use to assemble the <see cref="DescriptionSegments"/> into the entity's description.
/// Segments will be passed to the localization system with this string as variables named $part0, $part1, $part2, etc.
/// </summary>
[DataField]
public string DescriptionSeparator = " ";
public LocId DescriptionFormat = "random-metadata-description-format-default";
}