Localize alerts (#11838)

This commit is contained in:
Morb
2022-10-15 07:18:01 +03:00
committed by GitHub
parent 6f4bb040e4
commit 51acdefa4d
3 changed files with 152 additions and 58 deletions

View File

@@ -11,6 +11,9 @@ namespace Content.Shared.Alert
[Prototype("alert")]
public sealed class AlertPrototype : IPrototype, ISerializationHooks
{
private FormattedMessage _name = new ();
private FormattedMessage _description = new ();
[ViewVariables]
string IPrototype.ID => AlertType.ToString();
@@ -31,13 +34,21 @@ namespace Content.Shared.Alert
/// Name to show in tooltip window. Accepts formatting.
/// </summary>
[DataField("name")]
public FormattedMessage Name { get; private set; } = new();
public FormattedMessage Name
{
get => _name;
private set => _name = FormattedMessage.FromMarkup(Loc.GetString(value.ToString()));
}
/// <summary>
/// Description to show in tooltip window. Accepts formatting.
/// </summary>
[DataField("description")]
public FormattedMessage Description { get; private set; } = new();
public FormattedMessage Description
{
get => _description;
private set => _description = FormattedMessage.FromMarkup(Loc.GetString(value.ToString()));
}
/// <summary>
/// Category the alert belongs to. Only one alert of a given category