Skip culture check when unnecessary

This commit is contained in:
Kahbazi 2019-12-13 09:48:58 +03:30
parent fde783911b
commit a7bf77b877
4 changed files with 6 additions and 10 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
@ -59,8 +59,7 @@ namespace Microsoft.AspNetCore.Localization.Routing
// Value for culture but not for UI culture so default to culture value for both
uiCulture = culture;
}
if (culture == null && uiCulture != null)
else if (culture == null && uiCulture != null)
{
// Value for UI culture but not for culture so default to UI culture value for both
culture = uiCulture;
@ -71,4 +70,4 @@ namespace Microsoft.AspNetCore.Localization.Routing
return Task.FromResult(providerResultCulture);
}
}
}
}

View File

@ -109,8 +109,7 @@ namespace Microsoft.AspNetCore.Localization
// Value for culture but not for UI culture so default to culture value for both
uiCultureName = cultureName;
}
if (cultureName == null && uiCultureName != null)
else if (cultureName == null && uiCultureName != null)
{
// Value for UI culture but not for culture so default to UI culture value for both
cultureName = uiCultureName;

View File

@ -64,8 +64,7 @@ namespace Microsoft.AspNetCore.Localization
// Value for culture but not for UI culture so default to culture value for both
queryUICulture = queryCulture;
}
if (queryCulture == null && queryUICulture != null)
else if (queryCulture == null && queryUICulture != null)
{
// Value for UI culture but not for culture so default to UI culture value for both
queryCulture = queryUICulture;

View File

@ -126,8 +126,7 @@ namespace Microsoft.AspNetCore.Localization
{
cultureInfo = _options.DefaultRequestCulture.Culture;
}
if (cultureInfo != null && uiCultureInfo == null)
else if (cultureInfo != null && uiCultureInfo == null)
{
uiCultureInfo = _options.DefaultRequestCulture.UICulture;
}