Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization completely broken after migration from 6 to 8 when published to IIS #19804

Open
1 task done
antonGritsenko opened this issue May 13, 2024 · 2 comments
Open
1 task done
Labels

Comments

@antonGritsenko
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Description

I did migration from the 6 to 8 and now have weird problem with the localization.
My config:
DomainSharedModule.cs

public override void ConfigureServices(ServiceConfigurationContext context)
{
    Configure<AbpVirtualFileSystemOptions>(options =>
    {
        options.FileSets.AddEmbedded<MyAppDomainSharedModule>();
    });

    Configure<AbpLocalizationOptions>(options =>
    {
        options.Resources
            .Add<MyAppResource>("en")
            .AddBaseTypes(typeof(AbpValidationResource))
            .AddVirtualJson("/Localization/MyApp");

        options.Resources
            .Add<TBotResource>("ru")
            .AddVirtualJson("/Localization/TBot");

        options.DefaultResourceType = typeof(MyAppResource);
    });

    Configure<AbpExceptionLocalizationOptions>(options =>
    {
        options.MapCodeNamespace("MyApp", typeof(MyAppResource));
    });
}

HttpApiHostModule.cs

public override void ConfigureServices(ServiceConfigurationContext context)
{
    .......
     ConfigureLocalization();
    .......
}
private void ConfigureLocalization()
{
    Configure<AbpLocalizationOptions>(options =>
    {
        options.Languages.Add(new LanguageInfo("ru", "ru", "Русский"));
        options.Languages.Add(new LanguageInfo("en", "en", "English"));

        options.Resources
            .Get<AccountResource>()
            .AddVirtualJson("/Localization/AccountExtensions");
        options.Resources
           .Get<AbpUiResource>()
           .AddVirtualJson("/Localization/AbpUiExtensions");
    });
}

public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
    .......
    app.UseAbpRequestLocalization();
    .......
}

All json files are configured as Embedded resource.

it works fine with the v6 (the prod still have this version installed and there all good)

Reproduction Steps

  1. Upgrade from 6 to 8
  2. Have any custom strings in the json files (except ::Welcome, it localized in the AbpUi)
  3. Publish application and frontend to IIS
  4. Open angular app

Expected behavior

Location works as it should

Actual behavior

Debug or Release configuration executed from the VS: OK (I assumed this is because it taken files from the file system, but not sure)
Debug or Release configuration published to IIS: NOK
Symptoms:

  1. All strings from the local json files are not loaded at all
  2. All strings from OOB assemblies (Abp*) works as it should

Same behavior for asp-core and angular application: all custom strings are not loaded on Login page (we have few customizations there) and in entire Angular app.
Response from the api/abp/application-localization?cultureName=ru&onlyDynamics=false looks like this (only custom on the screenshot, all other are OK and have strings in the text element):
image

One strange thing: if all languages are enabled (options.Languages.Add removed) then Angular app doesn't load at all, without errors in the console.

Even if files are copied locally on the server (/Localization folder in the API site) it still doesn't work.

I did compare with the empty template generate withe v8 but can't find any diff.

Regression?

Yes

Known Workarounds

No

Version

8.1.1

User Interface

Angular

Database Provider

EF Core (Default)

Tiered or separate authentication server

Tiered

Operation System

Windows (Default)

Other information

Issue reproducible regardless configuration: same under Debug or Release.

Steps to trouble shooting this issue will be much appreciated.

@antonGritsenko
Copy link
Author

not IIS related, same issue if publish to folder and then execute the app.

@antonGritsenko
Copy link
Author

I have found the issue: https://docs.abp.io/en/abp/6.0/Virtual-File-System#embedding-the-files
v7 and above requires this package for localization, but v6 not.

If Development mode is enabled then it will be loaded from the file system, that's why it always work in VS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant