Hi guys,
I found that Volo.Identity.Pro module was lack of vietnamese. So I have to update empty string of target culture language as the following image. But it is not good way for many tenants or other cultures. Can I add a new localization json file into Volo Identity module and other modules? Can I modify values of the existed localization json files in Volo module packages? Could you share me the steps? Thanks
- ABP Framework version: v2.9.0
- UI type: Angular 9
- Identity Server Seperated (Angular): yes
- Exception message and stack trace:
- Steps to reproduce the issue:
15 Answer(s)
-
0
Hi,
See https://docs.abp.io/en/abp/latest/Localization#extending-existing-resource
-
0
Hi @liangshiwei, I refered to https://docs.abp.io/en/abp/latest/Localization#extending-existing-resource As I know, the document is only describe extending existing resource file in order to reuse in other classes. But It seems not point out how to add new or modify existing culture language file of Volo abp module. Could you share me the steps?
- How to add a new localization json file into Volo Identity Pro module?
- And how to modify values of the existed localization json files in Volo Identity Pro module or other Abp module packages?
-
1
- en.json Extend existing languages
```json { "culture": "en", "texts": { "TestKey": "This is test value" } } ```
- vi.json A new languages files
```json { "culture": "vi", "texts": { "TestKey": "Đây là giá trị được thử nghiệm" } } ```
Set as embedded file:
<ItemGroup> <EmbeddedResource Include="Localization\Identity\*.json" /> <Content Remove="Localization\Identity\*.json" /> </ItemGroup>
Extend localized resources for modules:
Configure<AbpLocalizationOptions>(options => { options.Resources .Get<IdentityResource>() .AddVirtualJson("/Localization/Identity"); });
Add Vietnamese culture:
That's all
-
0
@liangshiwei Thank you! It works well.
-
0
Hi @liangshiwei, thank for your guidance, that worked well for Volo Identiy. But when i try to add new vi.json file for Volo.Abp.Account.Application.Contracts(2.9.0) (package installed), i got some issues below: I can't see any vietnamese value in resource AbpAccount - Language Texts management:
But Vietnamese values showed correctly in ui:
And when i switch back to english, it seem a little weird:
What should i do?
-
0
Hi @liangshiwei, I have the same problem about AccountResource.
I added Volo.Abp.Account.Application.Contracts" Version="2.9.0" to XXX.Domain project. and add this code into xxxDomainModule.cs
options.Resources.Get<Volo.Abp.Account.Localization.AccountResource>().AddVirtualJson("/Localization/Account");
But Identity Server Seperated cannot start. Could you give me how to fix it?
---> Volo.Abp.AbpException: Can not find a resource with given type: Volo.Abp.Account.Localization.AccountResource, Volo.Abp.Account.Application.Contracts, Version=2.9.0.0, Culture=neutral, PublicKeyToken=null at Volo.Abp.Localization.LocalizationResourceDictionary.Get[TResource]()
-
0
@drpdev2 did you solve it or do you want me to check it?
-
0
Hi @alper: The issue has not solved yet. Can you kindly check it?
-
0
ok. we'll check it.
-
0
-
0
-
0
hi @drpdev2
It's only install the
XXX.Domain
pakcages inDomain
layer.You should configure the localization in different layers.
Configure
Account.Pro.Localizetion.AccountResource
in yourApplication.Contract
layer because theVolo.Abp.Account.Pro.Public.Application.Contracts
orVolo.Abp.Account.Pro.Admin.Application.Contracts
packages are installed the layer. -
0
-
0
hi @drpdev2
The
AccountResource
is exist in theVolo.Abp.Account.Pro.Shared.Application.Contracts
packageIf you stil can't resolve this problem you can send a email to me(liming.ma@volosoft.com), We can remotely check it via teamviewer.
-
0
Thanks @mailiming.
I found the package name. I implemented the localizationfor AccountResource in ApplicationContract layer as the following. It works well.
public class PortalApplicationContractsModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { Configure<AbpLocalizationOptions>(options => { options.Resources.Get<AccountResource>().AddVirtualJson("/Localization/Account"); }); base.ConfigureServices(context); } }