Skip to content
This repository was archived by the owner on Nov 29, 2018. It is now read-only.
This repository was archived by the owner on Nov 29, 2018. It is now read-only.

Data annotation localization current culture missmatch #371

@stenvix

Description

@stenvix

Technical details

Operating system: Windows 10
IDE: Visual Studio 2017 Professional Version 15.2(26430.6)
Runtime: .NET Core 1.1

Information

I had strange behaviour when use data annotation with "ResourceType",

Like in docs I init localization:
ConfigureServices

            services.AddLocalization(options => options.ResourcesPath = "Resources");

            services.AddMvc()
                .AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix)
                .AddDataAnnotationsLocalization();

Configure

            var supportedCultures = new List<CultureInfo>
            {
                new CultureInfo("en"),
                new CultureInfo("uk"),
                new CultureInfo("ru")
            };

            app.UseRequestLocalization(new RequestLocalizationOptions
            {
                DefaultRequestCulture = new RequestCulture("en"),
                SupportedCultures = supportedCultures,
                SupportedUICultures = supportedCultures
            });

In model I use attribute

[Display(Name = nameof(RememberMe), ResourceType = typeof(DataAnnotations))]

IHtmlLocalizer, IStringLocalizer working correctly, But name on DataAnnotations use Russian resx by default
English Language:
English
Link

But if I use Ukrainian language all working fine

Ukrainian Language:
Ukrainian
Link

Have any logical explanation why this happend??

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions