Localization blazor wasm does not work

Hello,
I am trying to download localization file and load it. I have downloaded cs.json from github, so it should be good.
Environment
Include="Syncfusion.Blazor"Version="18.1.0.48"/>
Include="Microsoft.AspNetCore.Components.WebAssembly"Version="3.2.0-rc1.20223.4"/>
Code
@usingSyncfusion.Blazor

<CascadingAuthenticationState>
<RouterAppAssembly="@typeof(Program).Assembly">
<FoundContext="routeData">
<AuthorizeRouteViewRouteData="@routeData"DefaultLayout="@typeof(MainLayout)">
<Authorizing>Authorizing,pleasewait...Authorizing>
<NotAuthorized>
<RedirectToLogin/>
NotAuthorized>
AuthorizeRouteView>
Found>
<NotFound>
<AuthorizeView>
<Authorized>
<LayoutViewLayout="@typeof(MainLayout)">

Sorry,there'snothingatthisaddress.

LayoutView>
Authorized>
<NotAuthorized>
<RedirectToLogin/>
NotAuthorized>
AuthorizeView>
NotFound>
Router>
CascadingAuthenticationState>
<ToastContainer/>

@code{
[Inject]
protectedIJSRuntimeJsRuntime{get;set;}
[Inject]
protectedHttpClientHttp{get;set;}

protectedoverrideasyncTaskOnAfterRenderAsync(boolfirstRender)
{
varlocale=awaitHttp.GetFromJsonAsync<object>("cs.json");
this.JsRuntime.Sf().LoadLocaleData(locale).SetCulture(culture);
}
}

I am getting this error:
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: The JSON value could not be converted to Syncfusion.Blazor.LocaleData. Path: $ | LineNumber: 0 | BytePositionInLine: 1.
System.Text.Json.JsonException: The JSON value could not be converted to Syncfusion.Blazor.LocaleData. Path: $ | LineNumber: 0 | BytePositionInLine: 1.
at System.Text.Json.ThrowHelper.ThrowJsonException_DeserializeUnableToConvertValue (System.Type propertyType) <0x5983038 + 0x00032> in :0
at System.Text.Json.JsonPropertyInfoNotNullable`4[TClass,TDeclaredProperty,TRuntimeProperty,TConverter].OnRead (System.Text.Json.ReadStack& state, System.Text.Json.Utf8JsonReader& reader) <0x5982d90 + 0x00016> in :0
at System.Text.Json.JsonPropertyInfo.Read (System.Text.Json.JsonTokenType tokenType, System.Text.Json.ReadStack& state, System.Text.Json.Utf8JsonReader& reader) <0x3e2bae0 + 0x000c8> in :0
at System.Text.Json.JsonSerializer.HandleValue (System.Text.Json.JsonTokenType tokenType, System.Text.Json.JsonSerializerOptions options, System.Text.Json.Utf8JsonReader& reader, System.Text.Json.ReadStack& state) <0x3e2b688 + 0x000a6> in :0
at System.Text.Json.JsonSerializer.ReadCore (System.Text.Json.JsonSerializerOptions options, System.Text.Json.Utf8JsonReader& reader, System.Text.Json.ReadStack& readStack) <0x3e2afb0 + 0x00340> in :0
at System.Text.Json.JsonSerializer.ReadCore (System.Type returnType, System.Text.Json.JsonSerializerOptions options, System.Text.Json.Utf8JsonReader& reader) <0x4b19d88 + 0x0002e> in :0
at System.Text.Json.JsonSerializer.Deserialize (System.String json, System.Type returnType, System.Text.Json.JsonSerializerOptions options) <0x4b19718 + 0x0017a> in :0
at System.Text.Json.JsonSerializer.Deserialize[TValue] (System.String json, System.Text.Json.JsonSerializerOptions options) <0x5879368 + 0x0000c> in :0
at Syncfusion.Blazor.Locale.SetLocale (System.String localeContent, System.Boolean webAssembly) <0x409d0f0 + 0x0008e> in :0
at Syncfusion.Blazor.Base.LoadLocaleData (System.Object localeObject) <0x5867828 + 0x00024> in :0

10 Replies

SB sbartos May 8, 2020 04:45 PM UTC

Hello, 
sorry for bothering. Can anyone look at this issue? Thanks


RN Rahul Narayanasamy Syncfusion Team May 11, 2020 06:30 AM UTC

Hi Ssvinciak, 

Greetings from Syncfusion. 

Query: Localization blazor wasm does not work 

We have validated your query and we are able to reproduce the reported problem in the latest version(18.1.0.48). We have already fixed the issue in internally and the fix for the issue will be included in our upcoming Volume 1 Service Pack release which is expected to be rolled out on or before May 13, 2020. Until then we appreciate your patience. 

Regards, 
Rahul 



SB sbartos May 11, 2020 10:49 AM UTC

Hello,

I do appreciate it.

Thanks


RN Rahul Narayanasamy Syncfusion Team May 12, 2020 05:22 AM UTC

Hi Ssvinciak, 

Thanks for the update. 

We will notify you once the release is successfully rolled out. 

Regards, 
Rahul 



RN Rahul Narayanasamy Syncfusion Team May 14, 2020 06:34 AM UTC

Hi Ssvinciak, 
  
We are glad to announce that our Essential Studio 2020 Volume 1 Service Pack1 release v18.1.0.52  is rolled out and is available for download under the following link. 
  
  
We have fixed the reported issue in our 18.1.0.52 release. So kindly upgrade to our latest version (18.1.0.52) to resolve the reported issue.  
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
  
Regards,            
Rahul 



SB sbartos May 14, 2020 07:48 AM UTC

Hello,

thanks for your reply.

I've upgraded to latest version. The error issue seems to be solved, because it doesn't show any errors. However, localization is not working. Code is not changed. I've checked also docs if something has changed, but there is no change. Can you provide example, please? Thanks


IV Ivan May 14, 2020 12:36 PM UTC

Same problem.
When setting the localization, according to the example
https://blazor.syncfusion.com/documentation/common/localization/?no-cache=1
an error occurs after loading the page:

[2020-05-14T12:29:20.600Z] Error: Microsoft.JSInterop.JSException: Unexpected token s in JSON at position 294
SyntaxError: Unexpected token s in JSON at position 294
    at JSON.parse (<anonymous>)
    at Object.load (https://localhost:44331/_content/Syncfusion.Blazor/scripts/syncfusion-blazor.min.js:1:152925)
    at https://localhost:44331/_framework/blazor.server.js:8:31421
    at new Promise (<anonymous>)
    at e.beginInvokeJSFromDotNet (https://localhost:44331/_framework/blazor.server.js:8:31390)
    at https://localhost:44331/_framework/blazor.server.js:1:19202
    at Array.forEach (<anonymous>)
    at e.invokeClientMethod (https://localhost:44331/_framework/blazor.server.js:1:19173)
    at e.processIncomingData (https://localhost:44331/_framework/blazor.server.js:1:17165)
    at e.connection.onreceive (https://localhost:44331/_framework/blazor.server.js:1:10276)
   at Microsoft.JSInterop.JSRuntime.InvokeWithDefaultCancellation[T](String identifier, Object[] args)
   at Syncfusion.Blazor.ResourceManager.SetJSCulture()
   at Syncfusion.Blazor.ResourceManager.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)


RN Rahul Narayanasamy Syncfusion Team May 15, 2020 12:09 PM UTC

Hi Ssvinciak & Ivan, 

We have validated your query and checked the reported problem at our end with latest version. But it works fine and we could not reproduce the reported problem. Find the below sample for your reference. 


Also we would like to inform that we have changed the keys case(in locale file) in one of our previous release for Pager. You need to change the Keys(First letter as Capital in particular locale(here pt.json file in wwwroot folder)) in locale file. Find the code snippets for reference.   
  
"pager": {  
            "CurrentPageInfo""{0} de {1} páginas",  
            "TotalItemsInfo""({0} itens)",  
            "FirstPageTooltip""Ir para a primeira página",  
            "LastPageTooltip""Ir para a última página",  
            "NextPageTooltip""Ir para a próxima página",  
            "PreviousPageTooltip""Ir para a página anterior",  
            "NextPagerTooltip""Ir para o próximo pager",  
            "PreviousPagerTooltip""Ir para o pager anterior",  
            "PagerDropDown""itens por página",  
            "PagerAllDropDown""Itens",  
            "All""Todos"  
        }  

If you are still facing the same problem, then could you please share the below details. It will be helpful to validate the problem further. 

  • Full Code snippets.
  • Video demonstration of the issue.
  • Exact replication steps.
  • Reproduce the reported problem in the provided sample.
  • Share simple reproduceable sample if possible.

Regards, 
Rahul 



SB sbartos May 16, 2020 06:38 PM UTC

Hello,

the problem was Pager missing uppercase. Thank you Rahul Narayanasamy.



RN Rahul Narayanasamy Syncfusion Team May 18, 2020 04:50 AM UTC

  
Hi Ssvinciak, 
 
Thanks for the update. 
 
We are happy to hear that the provided solution was helpful to resolve the reported problem. Please get back to us if you need further assistance. 
 
Regards, 
Rahul 


Loader.
Up arrow icon