Skip to content

Commit

Permalink
Ignore defaultLanguage if there is only one language.
Browse files Browse the repository at this point in the history
  • Loading branch information
maliming committed Dec 18, 2024
1 parent f36ae3d commit 97d90be
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ public virtual async Task<RequestLocalizationOptions> GetLocalizationOptionsAsyn

private static RequestCulture DefaultGetRequestCulture(string? defaultLanguage, IReadOnlyList<LanguageInfo> languages)
{
if (languages.Count == 1)
{
var language = languages.First();
return new RequestCulture(language.CultureName, language.UiCultureName);
}

if (defaultLanguage == null)
{
var firstLanguage = languages.First();
Expand All @@ -106,4 +112,4 @@ public virtual async Task HandleEventAsync(LanguageChangedEto eventData)
_requestLocalizationOptions = null;
}
}
}
}

0 comments on commit 97d90be

Please sign in to comment.