1

Ok, I have a weird one here. If my cookie is set to a non default language (i.e. french) it translates everything perfectly well when I first start the application, including data annotations.

However, if I change the language while the application is running, it will only switch the language on attributes using @Localizer["...."] but not the data annotations:

Application started with the cookie set in french language

Notice that Organization Details has been changed, but not the field labels. Used the interface to change back to English

I must mention that this is .NET Core 2.0, and I'm using portable files (*.po) with OrchardCore as per ASP.NET Core Instructions in the documentation.

services.AddPortableObjectLocalization(options => options.ResourcesPath= "Localization");

services
        .AddMvc()
        .AddViewLocalization()
        .AddDataAnnotationsLocalization()
        .AddJsonOptions(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());
    services.Configure<RequestLocalizationOptions>(options =>
    {
        var supportedCultures = new List<CultureInfo>
        {
            new CultureInfo("en"),
            new CultureInfo("de"),
            new CultureInfo("fr"),
            new CultureInfo("it")
        };

        options.DefaultRequestCulture = new RequestCulture("en");
        options.SupportedCultures = supportedCultures;
        options.SupportedUICultures = supportedCultures;
    });
TylerH
  • 20,799
  • 66
  • 75
  • 101
user1961008
  • 53
  • 1
  • 8

1 Answers1

0

After some research I found that this is a reported bug in the current beta version. It will be fixed in beta 2, which will be released soon (18 june)

Issue: https://github.com/OrchardCMS/OrchardCore/issues/1443

Milestone beta 2: https://github.com/OrchardCMS/OrchardCore/milestone/4?closed=1

FTMountain
  • 43
  • 1
  • 5