From 99b686d9d6034b52eb84562c6d5a2cd67aa4eba9 Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Thu, 22 Dec 2022 14:10:27 +0100 Subject: [PATCH] replace tokens in plain-text translation (without key) --- zero/Localization/Localizer.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/zero/Localization/Localizer.cs b/zero/Localization/Localizer.cs index de07d020..5395cee5 100644 --- a/zero/Localization/Localizer.cs +++ b/zero/Localization/Localizer.cs @@ -62,7 +62,17 @@ public abstract class Localizer : ILocalizer /// public string Maybe(string key, Dictionary 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); }