Skip to content

Commit

Permalink
tryFixLocalizationRule OrchardCMS#16153
Browse files Browse the repository at this point in the history
  • Loading branch information
hyzx86 committed May 25, 2024
1 parent 726e280 commit 5515b70
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

msgctxt "OrchardCore.Demo.Services"
msgid "This is an internationalisation rule test."
msgstr "这是一项国际化规则测试。"
10 changes: 10 additions & 0 deletions src/OrchardCore.Modules/OrchardCore.Demo/OrchardCore.Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,14 @@
<ProjectReference Include="..\..\OrchardCore\OrchardCore.Users.Core\OrchardCore.Users.Core.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Localization\zh-CN\" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Localization\zh-CN\OrchardCore.Demo.po">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.Extensions.Localization;

namespace OrchardCore.Demo.Services;
public class TestLocalizationService
{
private readonly IStringLocalizer S;

public TestLocalizationService(IStringLocalizer<TestLocalizationService> stringLocalizer)
{
S = stringLocalizer;
}

public string SayHello()
{
return S["This is an internationalisation rule test."];
}
}
1 change: 1 addition & 0 deletions src/OrchardCore.Modules/OrchardCore.Demo/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilde

public override void ConfigureServices(IServiceCollection services)
{
services.AddScoped<TestLocalizationService>();
services.AddScoped<ITestDependency, ClassFoo>();
services.AddScoped<ICommandHandler, DemoCommands>();
services.AddSingleton<IBackgroundTask, TestBackgroundTask>();
Expand Down
1 change: 1 addition & 0 deletions test/OrchardCore.Tests/OrchardCore.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

<ItemGroup>
<ProjectReference Include="..\..\src\OrchardCore.Cms.Web\OrchardCore.Cms.Web.csproj" />
<ProjectReference Include="..\..\src\OrchardCore.Modules\OrchardCore.Demo\OrchardCore.Demo.csproj" />
<ProjectReference Include="..\..\src\OrchardCore\OrchardCore.Apis.GraphQL.Abstractions\OrchardCore.Apis.GraphQL.Abstractions.csproj" />
<ProjectReference Include="..\..\src\OrchardCore\OrchardCore.Apis.GraphQL.Client\OrchardCore.Apis.GraphQL.Client.csproj" />
</ItemGroup>
Expand Down

0 comments on commit 5515b70

Please sign in to comment.