I have created microservice template for my application. I am currently implementing custom localization and also working on overriding the MyAccount localization provided by the Account module in my AuthServer MVC project, following the official documentation. However, the localization texts no being reflected.
Below is my implementation of custom/override the localization:
1. Created a new localization json file and resource.
2. Added AbpLocalizationOptions
and added AbpLocalizationModule
as [DependsOn] Dependency
using Volo.Abp.Localization;
using Volo.Abp.Account.Localization;
3. Injected IHtmlLocalizer<TestResource>
in index.cshtml
Could you please advise or review whether my implementation is correct?
Remarks: I also tried clearing the Redis cache using the Redis CLI command docker exec -it redis redis-cli flushall
, but unfortunately, it didn’t resolve the localization issue.
Thanks.
8 Answer(s)
-
0
hi
Can you test your code in a new
app
template project?then you can share the
app
project code.liming.ma@volosoft.com
Thanks.
-
0
Hi,
Sent via wetransfer.
Thanks.
-
0
hi
Configure<AbpVirtualFileSystemOptions>(options => { // "YourRootNameSpace" is the root namespace of your project. It can be empty if your root namespace is empty. options.FileSets.AddEmbedded<AbpLocalizationSingleLayerModule>(); }); Configure<AbpLocalizationOptions>(options => { //Define a new localization resource (TestResource) options.Resources .Add<TestResource>("en") .AddVirtualJson("/Localization/Test") .AddBaseTypes(typeof(AccountResource)); options.DefaultResourceType = typeof(TestResource); });
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="9.0.0" />
-
0
See https://abp.io/community/articles/understanding-the-embedded-files-in-abp-framework-nsrp8aa9#gsc.tab=0
-
0
-
0
hi
AddVirtualJson("/Localization/Test")
-
0
Hi
Tested in
app
template is working.. but not working inmicroservice
template. I have sent you the project via wetransfer. Could you please advise?Thanks.
-
0