RobustToolbox
RobustToolbox copied to clipboard
Custom type serializer for localized strings
trafficstars
So right now we do this for localized strings in prototypes and components:
[DataField("name", required: true)]
private string Name { get; } = default!;
[ViewVariables(VVAccess.ReadOnly)]
public string LocalizedName => Loc.GetString(Name);
That could be replaced by:
[DataField("name", customTypeSerializer: typeof(LocalizedStringSerializer))]
public string Name = default!;
or for list:
[DataField("name", customTypeSerializer: typeof(LocalizedStringListSerializer))]
public List<string> Names = new();
We can even run ingegration test, to see if content has all localized strings in english .ftl files.