Skip to content

Commit

Permalink
fix: i18n resource placement (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElderJames authored Aug 19, 2024
1 parent 38e0f9e commit 7976033
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 111 deletions.
8 changes: 8 additions & 0 deletions .template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@
"type": "computed",
"value": "(styles == 'less')"
},
"IsWebApp":{
"type": "computed",
"value": "(host == 'webapp')"
},
"IsNotWebApp":{
"type": "computed",
"value": "(host != 'webapp')"
},
"skipRestore": {
"type": "parameter",
"datatype": "bool",
Expand Down
2 changes: 1 addition & 1 deletion .template.config/templates/server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
});
builder.Services.Configure<ProSettings>(builder.Configuration.GetSection("ProSettings"));
builder.Services.AddInteractiveStringLocalizer();
builder.Services.AddLocalization(options => options.ResourcesPath = "Resources");
builder.Services.AddLocalization();
//#if (full)
builder.Services.AddScoped<IChartService, ChartService>();
builder.Services.AddScoped<IProjectService, ProjectService>();
Expand Down
2 changes: 1 addition & 1 deletion .template.config/templates/wasm/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static async Task Main(string[] args)
builder.Services.Configure<ProSettings>(builder.Configuration.GetSection("ProSettings"));
//#if (full)
builder.Services.AddInteractiveStringLocalizer();
builder.Services.AddLocalization(options => options.ResourcesPath = "Resources");
builder.Services.AddLocalization();

builder.Services.AddScoped<IChartService, ChartService>();
builder.Services.AddScoped<IProjectService, ProjectService>();
Expand Down
18 changes: 1 addition & 17 deletions src/AntDesign.Pro/AntDesign.Pro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,5 @@
<Watch Include="**\*.razor" />
<Watch Include="**\*.less" />
</ItemGroup>

<ItemGroup>
<Compile Update="Resources\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Resources\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<CustomToolNamespace>AntDesign.Pro.Template</CustomToolNamespace>
</EmbeddedResource>
</ItemGroup>


</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public partial class RightContent
[Inject] protected IProjectService ProjectService { get; set; }
[Inject] protected MessageService MessageService { get; set; }

[Inject] private IStringLocalizer<Resources> L { get; set; }
[Inject] private IStringLocalizer<I18n> L { get; set; }
[Inject] private ILocalizationService LocalizationService { get; set; }

protected override async Task OnInitializedAsync()
Expand Down
7 changes: 7 additions & 0 deletions src/AntDesign.Pro/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#if IsWebApp
global using AntDesign.Pro.Template.Client.Resources;
#elif IsNotWebApp
global using AntDesign.Pro.Template.Resources;
#else
global using AntDesign.Pro.Resources;
#endif
2 changes: 1 addition & 1 deletion src/AntDesign.Pro/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void AddClientServices(IServiceCollection services)
services.AddAntDesign();
//#if (full)
services.AddInteractiveStringLocalizer();
services.AddLocalization(options => options.ResourcesPath = "Resources");
services.AddLocalization();

services.AddScoped<IChartService, ChartService>();
services.AddScoped<IProjectService, ProjectService>();
Expand Down
12 changes: 12 additions & 0 deletions src/AntDesign.Pro/Resources/I18n.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#if IsWebApp
namespace AntDesign.Pro.Template.Client.Resources;
#elif IsNotWebApp
namespace AntDesign.Pro.Template.Resources;
#else
namespace AntDesign.Pro.Resources;
#endif


internal class I18n
{
}
File renamed without changes.
File renamed without changes.
90 changes: 0 additions & 90 deletions src/AntDesign.Pro/Resources/Resources.Designer.cs

This file was deleted.

0 comments on commit 7976033

Please sign in to comment.