Erweiterungsmethode hinzugefügt, um alle lokalisierten Zeichenfolgen im String-Localizer in ein Wörterbuch umzuwandeln.
This commit is contained in:
parent
5f84f6bcab
commit
401e742ea3
@ -55,5 +55,12 @@ namespace DigitalData.Core.API
|
||||
app.UseRequestLocalization(options);
|
||||
return app;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts all localized strings to a dictionary.
|
||||
/// </summary>
|
||||
/// <param name="localizer">The <see cref="IStringLocalizer"/> instance containing the localized strings.</param>
|
||||
/// <returns>A dictionary containing all localized strings, where the key is the name of the string and the value is the localized value.</returns>
|
||||
public static Dictionary<string, string> ToDictionary(this IStringLocalizer localizer) => localizer.GetAllStrings().ToDictionary(ls => ls.Name, ls => ls.Value);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user