diff --git a/Oqtane.Client/Extensions/OqtaneLocalizationExtensions.cs b/Oqtane.Client/Extensions/OqtaneLocalizationExtensions.cs new file mode 100644 index 00000000..6ee9c1eb --- /dev/null +++ b/Oqtane.Client/Extensions/OqtaneLocalizationExtensions.cs @@ -0,0 +1,22 @@ +namespace Microsoft.Extensions.Localization +{ + public static class OqtaneLocalizationExtensions + { + /// + /// Gets the string resource for the specified key and returns the value if the resource does not exist + /// + /// + /// the static key used to identify the string resource + /// the default value if the resource for the static key does not exist + /// + public static string GetString(this IStringLocalizer localizer, string key, string value) + { + string localizedValue = localizer[key]; + if (localizedValue == key) // not localized + { + localizedValue = value; + } + return localizedValue; + } + } +}