ASP .NET Core 1.0 RTM Localization not working

前端 未结 3 514
小蘑菇
小蘑菇 2020-12-19 07:09

I\'ve been trying to implement localization for my asp .NET Core 1.0 RTM web app following microsofts documentation and I just can not get it to work. The problem I\'m havin

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-19 07:57

    I experimented with i18n and I got my translations to work when supported cultures matched with the cultures in resource file names

    var supportedCultures = new List{
         new CultureInfo("en-US"),
         new CultureInfo("sl-SI"),
         new CultureInfo("de-DE"),
         new CultureInfo("hr-HR")
      };
    

    Change your resource file names from

    Resources/Views/ControllerName/ViewName.sl.resx

    to specific language culture

    Resources/Views/ControllerName/ViewName.sl-SI.resx

提交回复
热议问题