replace tokens in plain-text translation (without key)

This commit is contained in:
2022-12-22 14:10:27 +01:00
parent 8215267b0a
commit 99b686d9d6
+11 -1
View File
@@ -62,7 +62,17 @@ public abstract class Localizer : ILocalizer
/// <inheritdoc />
public string Maybe(string key, Dictionary<string, string> tokens)
{
return key.IsNullOrEmpty() || !key.StartsWith("@") ? key : Text(key.Substring(1), tokens);
if (key.IsNullOrEmpty() || !key.StartsWith("@"))
{
string value = key;
if (tokens != null)
{
value = TokenReplacement.Apply(value, tokens);
}
return value;
}
return Text(key.Substring(1), tokens);
}