From c02587da189268d820edd0dd1e28dc018614d861 Mon Sep 17 00:00:00 2001 From: Matasx Date: Sun, 8 Dec 2024 19:17:07 +0100 Subject: [PATCH] Simplification. --- .../LocalizationConcernBuilder.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Modules/GenHTTP.Modules.I18n/LocalizationConcernBuilder.cs b/Modules/GenHTTP.Modules.I18n/LocalizationConcernBuilder.cs index af114385..c857eb34 100644 --- a/Modules/GenHTTP.Modules.I18n/LocalizationConcernBuilder.cs +++ b/Modules/GenHTTP.Modules.I18n/LocalizationConcernBuilder.cs @@ -27,21 +27,15 @@ public sealed class LocalizationConcernBuilder : IConcernBuilder public LocalizationConcernBuilder AddFromCookie(string cookieName = "lang") => AddFromLanguage(request => { - if (request.Cookies.TryGetValue(cookieName, out var languageCookie)) - { - return languageCookie.Value; - } - return null; + request.Cookies.TryGetValue(cookieName, out var languageCookie); + return languageCookie.Value; }); public LocalizationConcernBuilder AddFromQuery(string queryName = "lang") => AddFromLanguage(request => { - if (request.Query.TryGetValue(queryName, out var language)) - { - return language; - } - return null; + request.Query.TryGetValue(queryName, out var language); + return language; }); public LocalizationConcernBuilder AddFromHeader(string headerName = "Accept-Language")