AlexTeixeira / Askmethat-Aspnet-JsonLocalizer

Json Localizer library for .NetStandard and .NetCore Asp.net projects
MIT License
91 stars 29 forks source link

Blazor sample I18nTestSample doesn't work #99

Closed ErikApption closed 3 years ago

ErikApption commented 4 years ago

IViewLocalizer ends up throwing an exception which according to https://docs.microsoft.com/en-us/aspnet/core/blazor/globalization-localization?view=aspnetcore-3.1 is expected:

A limited set of ASP.NET Core's localization scenarios are currently supported:

IStringLocalizer and IStringLocalizer<T> are supported in Blazor apps.
IHtmlLocalizer, IViewLocalizer, and Data Annotations localization are ASP.NET Core MVC scenarios and not supported in Blazor apps. 

The demo app works by replacing IViewLocalizer with IStringLocalizer

AlexTeixeira commented 4 years ago

Hi,

Good to know, Is something missing for Blazor App and I have this issue a lot of time on my developping days ^^

AlexTeixeira commented 4 years ago

After looking to the Common.cs, can you explain the usage of this class ? Is it like the fallback csharp file in classic Microsoft localization ?

ErikApption commented 4 years ago

Oh, yes I created Common.cs to demonstrate how to have multiple json translation files if I recall correctly. Also, no, I did not see anything missing for the blazor app.

AlexTeixeira commented 4 years ago

Ok. I will create a 3.1.0 today :)

AlexTeixeira commented 3 years ago

Code merged.