Open Closed

Localization with json or resx? #2414


User avatar
0
z2lai created
  • ABP Framework version: v5.0.1
  • UI type: Blazor Server
  • DB provider: EF Core

The docs show localization examples using json files, however, Telerik UI for Blazor provides localization in resx files. Is it recommended to manually convert these resx files to json to be used in ABP or can we also use resx files for localization in ABP?


1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    ABP can load localized resources from anywhere, you can write localized contributors from resx files。

    Example:

    public class MyVirtualFileLocalizationResourceContributor : VirtualFileLocalizationResourceContributorBase
    {
        public MyVirtualFileLocalizationResourceContributor (string virtualPath)
            : base(virtualPath)
        {
    
        }
    
        protected override bool CanParseFile(IFileInfo file)
        {
            ....
        }
    
        protected override ILocalizationDictionary CreateDictionaryFromFileContent(string jsonString)
        {
            ....
        }
    }
    
    Configure<AbpLocalizationOptions>(options =>
    {
        options
            .Resources
            .Add<DefaultResource>("en").Contributors.Add(new MyVirtualFileLocalizationResourceContributor(...));
    
    });
    
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on June 20, 2025, 11:20