зеркало из https://github.com/aspnet/Localization.git
Change compilation targets.
* Remove net451 as a compilation target * Upgrade to netcoreapp2.0
This commit is contained in:
Родитель
8c6c0624c8
Коммит
2587e08098
|
@ -33,3 +33,4 @@ nuget.exe
|
||||||
*launchSettings.json
|
*launchSettings.json
|
||||||
**/Resources/*.Designer.cs
|
**/Resources/*.Designer.cs
|
||||||
.vscode/
|
.vscode/
|
||||||
|
global.json
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<CoreFxVersion>4.3.0</CoreFxVersion>
|
<CoreFxVersion>4.3.0</CoreFxVersion>
|
||||||
<MoqVersion>4.7.1</MoqVersion>
|
<MoqVersion>4.7.1</MoqVersion>
|
||||||
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
|
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
|
||||||
|
<RuntimeFrameworkVersion>2.0.0-*</RuntimeFrameworkVersion>
|
||||||
<TestSdkVersion>15.0.0</TestSdkVersion>
|
<TestSdkVersion>15.0.0</TestSdkVersion>
|
||||||
<XunitVersion>2.2.0</XunitVersion>
|
<XunitVersion>2.2.0</XunitVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<Import Project="..\..\build\dependencies.props" />
|
<Import Project="..\..\build\dependencies.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net452;netcoreapp1.1</TargetFrameworks>
|
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -34,8 +34,11 @@ namespace LocalizationSample
|
||||||
new CultureInfo("zh"),
|
new CultureInfo("zh"),
|
||||||
new CultureInfo("zh-CN")
|
new CultureInfo("zh-CN")
|
||||||
};
|
};
|
||||||
#if !NETCOREAPP1_1
|
#if NET46
|
||||||
supportedCultures.Add(new CultureInfo("zh-CHT"));
|
supportedCultures.Add(new CultureInfo("zh-CHT"));
|
||||||
|
#elif NETCOREAPP2_0
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
var options = new RequestLocalizationOptions
|
var options = new RequestLocalizationOptions
|
||||||
{
|
{
|
||||||
|
@ -146,8 +149,11 @@ $@"<!doctype html>
|
||||||
await context.Response.WriteAsync($" <option value=\"{new CultureInfo("ja-JP").Name}\">{new CultureInfo("ja-JP").DisplayName}</option>");
|
await context.Response.WriteAsync($" <option value=\"{new CultureInfo("ja-JP").Name}\">{new CultureInfo("ja-JP").DisplayName}</option>");
|
||||||
await context.Response.WriteAsync($" <option value=\"{new CultureInfo("zh").Name}\">{new CultureInfo("zh").DisplayName}</option>");
|
await context.Response.WriteAsync($" <option value=\"{new CultureInfo("zh").Name}\">{new CultureInfo("zh").DisplayName}</option>");
|
||||||
await context.Response.WriteAsync($" <option value=\"{new CultureInfo("zh-CN").Name}\">{new CultureInfo("zh-CN").DisplayName}</option>");
|
await context.Response.WriteAsync($" <option value=\"{new CultureInfo("zh-CN").Name}\">{new CultureInfo("zh-CN").DisplayName}</option>");
|
||||||
#if NET451
|
#if NET46
|
||||||
await context.Response.WriteAsync($" <option value=\"{new CultureInfo("zh-CHT").Name}\">{new CultureInfo("zh-CHT").DisplayName}</option>");
|
await context.Response.WriteAsync($" <option value=\"{new CultureInfo("zh-CHT").Name}\">{new CultureInfo("zh-CHT").DisplayName}</option>");
|
||||||
|
#elif NETCOREAPP2_0
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
await context.Response.WriteAsync($" <option value=\"en-NOTREAL\">English (Not a real locale)</option>");
|
await context.Response.WriteAsync($" <option value=\"en-NOTREAL\">English (Not a real locale)</option>");
|
||||||
await context.Response.WriteAsync($" <option value=\"pp-NOTREAL\">Made-up (Not a real anything)</option>");
|
await context.Response.WriteAsync($" <option value=\"pp-NOTREAL\">Made-up (Not a real anything)</option>");
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Product>Microsoft ASP.NET Core</Product>
|
<Product>Microsoft ASP.NET Core</Product>
|
||||||
<Description>Provides a request culture provider which gets culture and ui-culture from request's route data.</Description>
|
<Description>Provides a request culture provider which gets culture and ui-culture from request's route data.</Description>
|
||||||
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
|
<TargetFramework>netstandard1.3</TargetFramework>
|
||||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;localization</PackageTags>
|
<PackageTags>aspnetcore;localization</PackageTags>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Product>Microsoft ASP.NET Core</Product>
|
<Product>Microsoft ASP.NET Core</Product>
|
||||||
<Description>ASP.NET Core middleware for automatically applying culture information to HTTP requests. Culture information can be specified in the HTTP header, query string, cookie, or custom source.</Description>
|
<Description>ASP.NET Core middleware for automatically applying culture information to HTTP requests. Culture information can be specified in the HTTP header, query string, cookie, or custom source.</Description>
|
||||||
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
|
<TargetFramework>netstandard1.3</TargetFramework>
|
||||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;localization</PackageTags>
|
<PackageTags>aspnetcore;localization</PackageTags>
|
||||||
|
|
|
@ -126,13 +126,8 @@ namespace Microsoft.AspNetCore.Localization
|
||||||
|
|
||||||
private static void SetCurrentThreadCulture(RequestCulture requestCulture)
|
private static void SetCurrentThreadCulture(RequestCulture requestCulture)
|
||||||
{
|
{
|
||||||
#if NET451
|
|
||||||
Thread.CurrentThread.CurrentCulture = requestCulture.Culture;
|
|
||||||
Thread.CurrentThread.CurrentUICulture = requestCulture.UICulture;
|
|
||||||
#else
|
|
||||||
CultureInfo.CurrentCulture = requestCulture.Culture;
|
CultureInfo.CurrentCulture = requestCulture.Culture;
|
||||||
CultureInfo.CurrentUICulture = requestCulture.UICulture;
|
CultureInfo.CurrentUICulture = requestCulture.UICulture;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CultureInfo GetCultureInfo(
|
private static CultureInfo GetCultureInfo(
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Product>Microsoft .NET Extensions</Product>
|
<Product>Microsoft .NET Extensions</Product>
|
||||||
<Description>Application localization services and default implementation based on ResourceManager to load localized assembly resources.</Description>
|
<Description>Application localization services and default implementation based on ResourceManager to load localized assembly resources.</Description>
|
||||||
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
|
<TargetFramework>netstandard1.3</TargetFramework>
|
||||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>localization</PackageTags>
|
<PackageTags>localization</PackageTags>
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
<Import Project="..\..\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks>
|
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks>
|
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<Import Project="..\..\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace Microsoft.AspNetCore.Localization.FunctionalTests
|
||||||
{
|
{
|
||||||
ApplicationBaseUriHint = applicationBaseUrl,
|
ApplicationBaseUriHint = applicationBaseUrl,
|
||||||
EnvironmentName = environmentName,
|
EnvironmentName = environmentName,
|
||||||
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net452" : "netcoreapp1.1"
|
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net46" : "netcoreapp2.0"
|
||||||
};
|
};
|
||||||
|
|
||||||
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger))
|
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger))
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
<Import Project="..\..\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks>
|
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks>
|
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
<Import Project="..\..\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks>
|
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks>
|
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -37,13 +37,9 @@ namespace Microsoft.AspNetCore.Localization.Tests
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var explicitCulture = new CultureInfo("fr-FR");
|
var explicitCulture = new CultureInfo("fr-FR");
|
||||||
#if NET452
|
|
||||||
Thread.CurrentThread.CurrentCulture = explicitCulture;
|
|
||||||
Thread.CurrentThread.CurrentUICulture = explicitCulture;
|
|
||||||
#else
|
|
||||||
CultureInfo.CurrentCulture = explicitCulture;
|
CultureInfo.CurrentCulture = explicitCulture;
|
||||||
CultureInfo.CurrentUICulture = explicitCulture;
|
CultureInfo.CurrentUICulture = explicitCulture;
|
||||||
#endif
|
|
||||||
// Act
|
// Act
|
||||||
var options = new RequestLocalizationOptions();
|
var options = new RequestLocalizationOptions();
|
||||||
|
|
||||||
|
@ -78,13 +74,8 @@ namespace Microsoft.AspNetCore.Localization.Tests
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var explicitCulture = new CultureInfo("fr-FR");
|
var explicitCulture = new CultureInfo("fr-FR");
|
||||||
#if NET452
|
|
||||||
Thread.CurrentThread.CurrentCulture = explicitCulture;
|
|
||||||
Thread.CurrentThread.CurrentUICulture = explicitCulture;
|
|
||||||
#else
|
|
||||||
CultureInfo.CurrentCulture = explicitCulture;
|
CultureInfo.CurrentCulture = explicitCulture;
|
||||||
CultureInfo.CurrentUICulture = explicitCulture;
|
CultureInfo.CurrentUICulture = explicitCulture;
|
||||||
#endif
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var options = new RequestLocalizationOptions();
|
var options = new RequestLocalizationOptions();
|
||||||
|
@ -96,13 +87,8 @@ namespace Microsoft.AspNetCore.Localization.Tests
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
#if NET452
|
|
||||||
Thread.CurrentThread.CurrentCulture = _initialCulture;
|
|
||||||
Thread.CurrentThread.CurrentUICulture = _initialUICulture;
|
|
||||||
#else
|
|
||||||
CultureInfo.CurrentCulture = _initialCulture;
|
CultureInfo.CurrentCulture = _initialCulture;
|
||||||
CultureInfo.CurrentUICulture = _initialUICulture;
|
CultureInfo.CurrentUICulture = _initialUICulture;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
<Import Project="..\..\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks>
|
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks>
|
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
|
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
|
||||||
<PackageReference Include="System.Resources.Writer" Version="$(CoreFxVersion)" />
|
<PackageReference Include="System.Resources.Writer" Version="$(CoreFxVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
<Import Project="..\..\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net452;netstandard1.6</TargetFrameworks>
|
<TargetFramework>netstandard1.0</TargetFramework>
|
||||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.6</TargetFrameworks>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
<Import Project="..\..\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net452;netstandard1.6</TargetFrameworks>
|
<TargetFramework>netstandard1.3</TargetFramework>
|
||||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.6</TargetFrameworks>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче