Skip to content

Commit

Permalink
Simplification.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matasx committed Dec 8, 2024
1 parent ae7779f commit c02587d
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions Modules/GenHTTP.Modules.I18n/LocalizationConcernBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit c02587d

Please sign in to comment.