Skip to content

Commit

Permalink
Merge pull request #7 from flier268/main
Browse files Browse the repository at this point in the history
Broken change: Just support standard 2.0 & 2.1
  • Loading branch information
Cricle authored Aug 14, 2023
2 parents 7395608 + ecde2bb commit 0047fd6
Show file tree
Hide file tree
Showing 48 changed files with 475 additions and 803 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ jobs:
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco -v
- name: setup-msbuild
run: |
choco install visualstudio2022buildtools --package-parameters "--includeRecommended"
choco install visualstudio2022-workload-universalbuildtools --package-parameters "--includeRecommended"
refreshenv
- name: Add Path
run: |
Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\"
- name: Install opencover&codecov
shell: powershell
run: |
Expand All @@ -53,7 +61,8 @@ jobs:
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"Cricle_Ao.Lang" /o:"cricle" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="results.xml"
dotnet build lang.sln -c Release
& msbuild /p:Configuration=Release -t:restore -m
& msbuild /p:Configuration=Release -m
OpenCover.Console.exe -target:test.bat -register:user
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
20 changes: 14 additions & 6 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,26 @@ on:

jobs:
build:

runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: setup-msbuild
run: |
choco install visualstudio2022buildtools --package-parameters "--includeRecommended"
choco install visualstudio2022-workload-universalbuildtools --package-parameters "--includeRecommended"
refreshenv
- name: Add Path
run: |
Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\"
- name: Build
run: dotnet build --no-restore
run: |
& msbuild /p:Configuration=Release -t:restore -m
& msbuild /p:Configuration=Release -m
- name: Test
run: dotnet test --no-build --verbosity normal
# run: cmd /c "dotnet test --no-build -c Release"
run: dotnet vstest ((ls -Recurse *.Test.dll | % FullName) -Match "\\bin\\Release\\")
57 changes: 29 additions & 28 deletions eng/pkg.props
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
<Project>
<PropertyGroup>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>4.3.0-preview.2</Version>
<NoWarn>CS1591;</NoWarn>
<Description>
This is cross platform i18n library.
It not only can provider static string, and it can hot reload/hot switch culture, use in wpf xaml etc...
This package is base on Microsoft.Extensions.Configuration.
If you want some other support files, you can intall package Microsoft.Extensions.Configuration.* or install Ao.Lang.Sources.
If you want us it in wpf, you can install Ao.Lang.Wpf.

Already implement *.resx and *.resources(or stream) reader. If you wan use embed resources, you can use extensions methods.
If you want auto add lang files, you can named file *.zh-cn.json/*.zh-cn.resx to Raise.
If you want auto add lang resources, you can named compile rex file *.zh_cn.*.resouces and index your lang identity.
In 4.3.x, support argument binding!

And it support wpf, uwp, avaloniaui, uno, asp.net core
</Description>
<Company>Ao.Lang</Company>
<Product>Ao.Lang</Product>
<RepositoryUrl>https://github.com/Cricle/Ao.Lang</RepositoryUrl>
<PackageTags>ao;lang;i18n;localization;uwp;wpf;avaloniaui;uno;asp;</PackageTags>
<PackageReleaseNotes>Relase for wpf, uwp, avaloniaui, uno platform, asp.net core</PackageReleaseNotes>
<PackageProjectUrl>https://github.com/Cricle/Ao.Lang</PackageProjectUrl>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>4.3.0-preview.2</Version>
<NoWarn>CS1591;</NoWarn>
<Description>
This is cross platform i18n library.
It not only can provider static string, and it can hot reload/hot switch culture, use in wpf xaml etc...
This package is base on Microsoft.Extensions.Configuration.
If you want some other support files, you can intall package Microsoft.Extensions.Configuration.* or install Ao.Lang.Sources.
If you want us it in wpf, you can install Ao.Lang.Wpf.

Already implement *.resx and *.resources(or stream) reader. If you wan use embed resources, you can use extensions methods.
If you want auto add lang files, you can named file *.zh-cn.json/*.zh-cn.resx to Raise.
If you want auto add lang resources, you can named compile rex file *.zh_cn.*.resouces and index your lang identity.
In 4.3.x, support argument binding!

And it support wpf, uwp, avaloniaui, uno, asp.net core
</Description>
<Company>Ao.Lang</Company>
<Product>Ao.Lang</Product>
<Authors>Ao.Lang</Authors>
<RepositoryUrl>https://github.com/Cricle/Ao.Lang</RepositoryUrl>
<PackageTags>ao;lang;i18n;localization;uwp;wpf;avaloniaui;uno;asp;</PackageTags>
<PackageReleaseNotes>Relase for wpf, uwp, avaloniaui, uno platform, asp.net core</PackageReleaseNotes>
<PackageProjectUrl>https://github.com/Cricle/Ao.Lang</PackageProjectUrl>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
</Project>
3 changes: 0 additions & 3 deletions eng/sources.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@
<UsingNETStandard>true</UsingNETStandard>
<DefineConstants>UsingNETStandard;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='netstandard2.0' or '$(TargetFramework)'=='net461' or '$(TargetFramework)'=='netcoreapp3.0' or '$(TargetFramework)'=='net5.0'">
<UsingGreatOrEqualTf>true</UsingGreatOrEqualTf>
</PropertyGroup>
</Project>
5 changes: 1 addition & 4 deletions samples/Ao.Lang.Asp/Ao.Lang.Asp.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand All @@ -13,7 +13,4 @@
<ItemGroup>
<Folder Include="Views\" />
</ItemGroup>

<ProjectExtensions><VisualStudio><UserProperties properties_4launchsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>

</Project>
13 changes: 8 additions & 5 deletions samples/Ao.Lang.AvaloniaUI.Sample/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ private void InitializeComponent()
tbx.BindText("Title");
var btn = new Button { Content = "Çл»" };
btn.Click += Btn_Click;
var sp = Content as StackPanel;
sp.Children.Add(tbx);
sp.Children.Add(btn);

if (Content is StackPanel sp)
{
sp.Children.Add(tbx);
sp.Children.Add(btn);
}
else
throw new System.Exception("Should be StackPanel");
}

private void Btn_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
Expand All @@ -38,8 +43,6 @@ private void Btn_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
{
LanguageManager.Instance.SetCulture("zh-cn");
}


}
}
}
2 changes: 1 addition & 1 deletion samples/Ao.Lang.Sample/Ao.Lang.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 6 additions & 1 deletion samples/Ao.Lang.Uwp.Sample/Ao.Lang.Uwp.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,16 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration">
<Version>6.0.0</Version>
<Version>7.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.12</Version>
</PackageReference>
<PackageReference Include="NuGet.Build.Tasks.Pack">
<Version>6.4.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Ao.Lang.Uwp\Ao.Lang.Uwp.csproj">
Expand Down
4 changes: 2 additions & 2 deletions samples/Ao.Lang.Wpf.Preview/Ao.Lang.Wpf.Preview.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net472</TargetFramework>
<TargetFramework>net462</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>

Expand All @@ -13,7 +13,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/Ao.Lang.Wpf.Sample/Ao.Lang.Wpf.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net461;net5.0-windows</TargetFrameworks>
<TargetFrameworks>net462;net6.0-windows;</TargetFrameworks>
<UseWPF>true</UseWPF>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net461</TargetFrameworks>
<TargetFrameworks>net462</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions src/Ao.Lang.AspNetCore/AnyHtmlLocalizer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Ao.Lang;
using Ao.Lang.Runtime;
using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.Extensions.Localization;

Expand All @@ -12,7 +11,8 @@ public AnyHtmlLocalizer(ILangSectionProvider provider, ILanguageRoot root)
{
}
}
public class AnyHtmlLocalizer : AnyStringLocalizer,IHtmlLocalizer

public class AnyHtmlLocalizer : AnyStringLocalizer, IHtmlLocalizer
{
public AnyHtmlLocalizer(string sectionKey, ILanguageRoot root) : base(sectionKey, root)
{
Expand All @@ -23,7 +23,7 @@ public AnyHtmlLocalizer(string sectionKey, ILanguageRoot root) : base(sectionKey
get
{
var s = base.GetString(name);
return new LocalizedHtmlString(name, s??string.Empty, s == null);
return new LocalizedHtmlString(name, s ?? string.Empty, s == null);
}
}

Expand All @@ -40,14 +40,14 @@ public AnyHtmlLocalizer(string sectionKey, ILanguageRoot root) : base(sectionKey
}
}

public LocalizedString GetString(string name)
public new LocalizedString GetString(string name)
{
return base[name];
}

public LocalizedString GetString(string name, params object[] arguments)
{
return base[name,arguments];
return base[name, arguments];
}
}
}
}
2 changes: 1 addition & 1 deletion src/Ao.Lang.AspNetCore/Ao.Lang.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\eng\pkg.props" />

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFrameworks>net6.0;</TargetFrameworks>
<DefineConstants>$(DefineConstants);ASP_PLATFORM</DefineConstants>
</PropertyGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Ao.Lang.AvaloniaUI/Ao.Lang.AvaloniaUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<Import Project="..\..\eng\pkg.props" />

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.1;netstandard2.0;</TargetFrameworks>
<DefineConstants>$(DefineConstants);AVALONIAUI_PLATFORM</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.10" />
<PackageReference Include="Avalonia" Version="0.10.18" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Ao.Lang.Wpf\*.cs" />
Expand Down
9 changes: 3 additions & 6 deletions src/Ao.Lang.Generator.Json/Ao.Lang.Generator.Json.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@
<Import Project="..\..\eng\pkg.props" />

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461;netstandard1.3;</TargetFrameworks>
<TargetFrameworks>netstandard2.1;netstandard2.0;</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Ao.Lang.Generator\Ao.Lang.Generator.csproj" />
<ProjectReference Include="..\Ao.Lang\Ao.Lang.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net452' or '$(TargetFramework)'=='netstandard1.3'">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.2" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'!='net452' and '$(TargetFramework)'!='netstandard1.3'">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\eng\pkg.props" />

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;netstandard2.0;</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Ao.Lang.Generator/Ao.Lang.Generator.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\eng\pkg.props" />
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461;netstandard1.3;</TargetFrameworks>
<TargetFrameworks>netstandard2.1;netstandard2.0;</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Ao.Lang\Ao.Lang.csproj" />
Expand Down
10 changes: 4 additions & 6 deletions src/Ao.Lang.Sources/Ao.Lang.Sources.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
<Import Project="..\..\eng\pkg.props" />
<Import Project="..\..\eng\sources.props" />
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461;net6.0;</TargetFrameworks>
<TargetFrameworks>netstandard2.1;netstandard2.0;</TargetFrameworks>
<NoWarn>CS1591;</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="7.0.0" />
<PackageReference Include="NetEscapades.Configuration.Yaml" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
Expand Down
Loading

0 comments on commit 0047fd6

Please sign in to comment.