Open Closed

Load Localization JSONs during Runtime #4446


User avatar
0
BassaSolutions created
  • ABP Framework version: v5.1.4
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

We want to update localization Files (e.g. en.json) during runtime (e.g. when application is restarted).

Documentation (https://docs.abp.io/en/abp/latest/Localization) says

"JSON files are embedded into the assembly using AbpVirtualFileSystemOptions (see virtual file system)."

Configure<AbpLocalizationOptions>(options =>
        {
            //Define a new localization resource (MyProjectName)
            options.Resources
                .Add<MyProjectName>("en")
                .AddVirtualJson("/Localization/MyProjectName");
        });

And on https://docs.abp.io/en/abp/latest/Virtual-File-System:

"Physical files always override the virtual files. That means if you put a file under the /wwwroot/my-folder/my-file.css, it will override the file in the same location of the virtual file system. So, you need to know the file paths defined in the modules to override them."

Now when I put a file there, e.g. /wwwroot/Localization/MyProjectName/en.json, it does not overwrite the localization text. I also tried /Localization/MyProjectName/en.json, which also does not work.

So my question is, how is it possible to update whole localization JSON files during runtime?

Updating single texts via UI Administration->Language Management does not solve the issue, as we have hundreds of texts

Thank you in advance!


3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The JSON files compiled into assembly DLL so it doesn't work.

  • User Avatar
    0
    BassaSolutions created

    So there is no way to make it work?

    Often localization JSONs in projects are made to be changeable during runtime, so I thought maybe ABP has something like this.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    So there is no way to make it work?

    I'm afraid yes

Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38