From 401e742ea35c81d328438620ab31827eb39333ab Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Fri, 31 May 2024 09:31:59 +0200 Subject: [PATCH] =?UTF-8?q?Erweiterungsmethode=20hinzugef=C3=BCgt,=20um=20?= =?UTF-8?q?alle=20lokalisierten=20Zeichenfolgen=20im=20String-Localizer=20?= =?UTF-8?q?in=20ein=20W=C3=B6rterbuch=20umzuwandeln.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalData.Core.API/LocalizationExtensions.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/DigitalData.Core.API/LocalizationExtensions.cs b/DigitalData.Core.API/LocalizationExtensions.cs index a33016d..ab1d1f4 100644 --- a/DigitalData.Core.API/LocalizationExtensions.cs +++ b/DigitalData.Core.API/LocalizationExtensions.cs @@ -55,5 +55,12 @@ namespace DigitalData.Core.API app.UseRequestLocalization(options); return app; } + + /// + /// Converts all localized strings to a dictionary. + /// + /// The instance containing the localized strings. + /// A dictionary containing all localized strings, where the key is the name of the string and the value is the localized value. + public static Dictionary ToDictionary(this IStringLocalizer localizer) => localizer.GetAllStrings().ToDictionary(ls => ls.Name, ls => ls.Value); } -} +} \ No newline at end of file