CultureInfoCache.GetCultureInfo Should not be case sensitive
This commit is contained in:
parent
b22474afb3
commit
722fbc4ef5
|
|
@ -34,6 +34,7 @@ namespace CultureInfoGenerator
|
||||||
// *************************** THIS FILE IS GENERATED BY A TOOL ***************************
|
// *************************** THIS FILE IS GENERATED BY A TOOL ***************************
|
||||||
// To make changes to this file look at the CultureInfoGenerator project in this solution.
|
// To make changes to this file look at the CultureInfoGenerator project in this solution.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.Extensions.Globalization
|
namespace Microsoft.Extensions.Globalization
|
||||||
|
|
@ -49,7 +50,7 @@ namespace Microsoft.Extensions.Globalization
|
||||||
/// As new versions of .NET Framework and Windows are released, this list should be regenerated to ensure it
|
/// As new versions of .NET Framework and Windows are released, this list should be regenerated to ensure it
|
||||||
/// contains the latest culture names.
|
/// contains the latest culture names.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly HashSet<string> KnownCultureNames = new HashSet<string>
|
public static readonly HashSet<string> KnownCultureNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
||||||
{{"
|
{{"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
// *************************** THIS FILE IS GENERATED BY A TOOL ***************************
|
// *************************** THIS FILE IS GENERATED BY A TOOL ***************************
|
||||||
// To make changes to this file look at the CultureInfoGenerator project in this solution.
|
// To make changes to this file look at the CultureInfoGenerator project in this solution.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.Extensions.Globalization
|
namespace Microsoft.Extensions.Globalization
|
||||||
|
|
@ -19,7 +20,7 @@ namespace Microsoft.Extensions.Globalization
|
||||||
/// As new versions of .NET Framework and Windows are released, this list should be regenerated to ensure it
|
/// As new versions of .NET Framework and Windows are released, this list should be regenerated to ensure it
|
||||||
/// contains the latest culture names.
|
/// contains the latest culture names.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly HashSet<string> KnownCultureNames = new HashSet<string>
|
public static readonly HashSet<string> KnownCultureNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
||||||
{
|
{
|
||||||
"",
|
"",
|
||||||
"af",
|
"af",
|
||||||
|
|
|
||||||
|
|
@ -167,5 +167,31 @@ namespace Microsoft.Extensions.Localization.Tests
|
||||||
var response = await client.GetAsync("/page?c=ar-SA&uic=ar-YE");
|
var response = await client.GetAsync("/page?c=ar-SA&uic=ar-YE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async void GetTheRightCultureInfoRegardlessOfCultureNameCasing()
|
||||||
|
{
|
||||||
|
using (var server = TestServer.Create(app =>
|
||||||
|
{
|
||||||
|
var options = new RequestLocalizationOptions();
|
||||||
|
var provider = new QueryStringRequestCultureProvider();
|
||||||
|
provider.QueryStringKey = "c";
|
||||||
|
provider.UIQueryStringKey = "uic";
|
||||||
|
options.RequestCultureProviders.Insert(0, provider);
|
||||||
|
app.UseRequestLocalization(options);
|
||||||
|
app.Run(context =>
|
||||||
|
{
|
||||||
|
var requestCultureFeature = context.Features.Get<IRequestCultureFeature>();
|
||||||
|
var requestCulture = requestCultureFeature.RequestCulture;
|
||||||
|
Assert.Equal("fr", requestCulture.Culture.ToString());
|
||||||
|
Assert.Equal("fr", requestCulture.UICulture.ToString());
|
||||||
|
return Task.FromResult(0);
|
||||||
|
});
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
var client = server.CreateClient();
|
||||||
|
var response = await client.GetAsync("/page?c=FR&uic=FR");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue