How to implement Blazor Localization Guide?

Hi team,

As Blazor Localization Guide Step 3 mentioned, I should implement a  ISyncfusionStringLocalizer interface, but the sample code has something odd to me: What dose

return ApplicationNamespace.Resources.SfResources.ResourceManager;

mean?

I have put SfResources.xx.resx into Resoueces folder of my project, but "Resources.SfResources.ResourceManager" in my namespace references nothing. Is the code something wrong or I missed some important part?

please guide me,
thanks a lot.

21 Replies

JA Jesus Arockia Sankaran S Syncfusion Team April 16, 2020 06:56 AM UTC

Hi Genni, 

Thanks for contacting Syncfusion support.  

Sorry for the inconvenience caused and we have checked your query and “ApplicationNamespace” is the namespace of the application. For example, if our application name is “BlazorApp” then we should use this. We have also prepared a sample for your reference that you can download from the below link.  


We request you to share more illustrative information such as video, screenshot if we misunderstood your query. 

Please get back to us if you need any further assistance on this. 

Regards, 
Jesus Arockia Sankaran S 



BR Brian April 17, 2020 01:01 AM UTC

Thank you for reply, it's turn out to be the problem of PublicResXFileCodeGenerator. There is no exact reason why my IDE didn't generate .Designer.cs file automatic, so the class reference is missing. I have fixed that right now and it's definitely my own case. 

Your sample in the reply is still helping, thanks a lot.


BR Brian replied to Jesus Arockia Sankaran S April 17, 2020 02:43 AM UTC

Hi Genni, 

Thanks for contacting Syncfusion support.  

Sorry for the inconvenience caused and we have checked your query and “ApplicationNamespace” is the namespace of the application. For example, if our application name is “BlazorApp” then we should use this. We have also prepared a sample for your reference that you can download from the below link.  


We request you to share more illustrative information such as video, screenshot if we misunderstood your query. 

Please get back to us if you need any further assistance on this. 

Regards, 
Jesus Arockia Sankaran S 


Hi Team,

I have tried the sample, but it seems still something abnormal. Within the original code, I added two other components to show the local effects but failed. Here is what I did:

1. added "new CultureInfo("zh")" to supportedCultures in Startup.cs line 42;
2. added "<option value="zh">Chinese</option>" in CultureChooser.razor line 13 and "new  CultureData() { Text = "Chinese", Value = "zh" }" at line 45;
3. added two components of SfSchedule and SfGrid, the former from another post and the latter from the Guide. For details of this source, please refer to the attachment.

Recompiled completely and run, then Issue occurred. Whatever culture I select, except eu-US, error reported in brower console:


[2020-04-17T02:27:11.703Z] Information: Normalizing '_blazor' to 'https://localhost:5001/_blazor'.
blazor.server.js:1 [2020-04-17T02:27:11.801Z] Information: WebSocket connected to wss://localhost:5001/_blazor?id=wgmdqnzEuAruZQcIu9LmXw.
syncfusion-blazor.js:826 Cannot read property 'trim' of undefined
TypeError: Cannot read property 'trim' of undefined
    at Week.ViewBase.formatDateRange (https://localhost:5001/ej2.min.js:588260:41)
    at Week.ViewBase.getDateRangeText (https://localhost:5001/ej2.min.js:588231:21)
    at Render.updateHeader (https://localhost:5001/ej2.min.js:580199:77)
    at Render.initializeLayout (https://localhost:5001/ej2.min.js:580179:14)
    at Render.render (https://localhost:5001/ej2.min.js:580100:14)
    at Schedule.initializeView (https://localhost:5001/ej2.min.js:582836:27)
    at Schedule.renderElements (https://localhost:5001/ej2.min.js:582664:14)
    at Schedule.initializeResources (https://localhost:5001/ej2.min.js:582646:18)
    at Schedule.render (https://localhost:5001/ej2.min.js:582478:14)
    at Schedule.Component.appendTo (https://localhost:5001/ej2.min.js:6537:18)
throwError @ syncfusion-blazor.js:826
initialize @ syncfusion-blazor.js:133
(anonymous) @ blazor.server.js:8
beginInvokeJSFromDotNet @ blazor.server.js:8
(anonymous) @ blazor.server.js:1
e.invokeClientMethod @ blazor.server.js:1
e.processIncomingData @ blazor.server.js:1
connection.onreceive @ blazor.server.js:1
i.onmessage @ blazor.server.js:1

The only changed is currency symbol and all other texts were not localized. It seems the sample only works fine with SfCalendar.

Could you please check what's the matter with this?

Attachment: ServerLocalizationResxIssue_89bfb3c1.zip


BR Brian April 18, 2020 01:24 AM UTC

Further more, I made a try to implant localization part of the sample project you supplied into syncfusion official big sample project which resides in "C:\Users\Public\Documents\Syncfusion\Blazor\18.1.0.42", it dose not work out too. 

All error report is similar. Until now, I have tried some different components and all of them failed to be localized except DatePicker. Even though many of them have "Locale" property, but when I set it, whatever available value is, the browser console will report error.

Could you please supply a sample with Grid component work with Locale property work with "de", "fr-CH". and "zh"?

Attachment: DateTimeIssueShortcut_5fd1f6b7.zip


JA Jesus Arockia Sankaran S Syncfusion Team April 19, 2020 01:05 PM UTC

Hi Genii, 

Sorry for the inconvenience. 

Query: Could you please supply a sample with Grid component work with Locale property work with "de", "fr-CH". and "zh"? 
 
We have prepared a sample for your reference with requested cultures that can be downloaded from the below link.  
 
 
We request you to add the “Key Value pair” of localization strings for the components used in the application from the GitHub localization resource files where we have localization resource details all components in culture wise.  
 
Query: Further more, I made a try to implant localization part of the sample project you supplied into syncfusion official big sample project which resides in "C:\Users\Public\Documents\Syncfusion\Blazor\18.1.0.42", it dose not work out too.  
 
We have already planned to give localization support for our demo site and will update you the timeline for this in two business day on April 21, 2020. 
 
Please get back to us if you need any further assistance on this.  
 
Regards, 
Jesus Arockia Sankaran S 



BR Brian April 20, 2020 02:56 AM UTC

Hi team,

It seems that I should copy and paste parts of those Key-Value pairs from the source resx files into a new one to use. But why couldn't I use those source resx files directly If I don't care about the size or something and just want to localize all components without those picking burden? I compared the two edition of resx files from Resource and Resources-src folders, the only difference is the former ones are shorter. But If I overwrite any file in  Resource folder with the relative integral edition from Resources-src folder, the console error emerged again. Could you please explain the reason?

I am so sorry if I bothered too much, thanks for all you helping.


BR Brian April 21, 2020 01:46 AM UTC

Hi team,

Even if I only keep selecting the same Culture in the running sample several times, there is probability the abnormal rendering appears. I uploaded a short video to show the issue. In order to make clear the cause of this problem, I did a lot of test under different Dev environments. The result shows that the problem maybe caused by several sources together, including dev tools(Visual Studio or Rider) and resx file sizes differences.

Under Rider, the problem appeared more frequently, maybe once in two or three clicks, but the case in VS was slightly different, maybe once in ten or more, impressively better than the former. And, the larger the resx file was, added more entries for example, the issue appeared more easily. the extreme case was that if I directly use resx files from the src folder, the disordered rendering becomes absolute. The exact reason is still unclear, since I am using preview version of VS and dotnet core SDK. But I still wish you could give some attention to this issue.

Attachment: ScreenShot_59a2823e.zip


JA Jesus Arockia Sankaran S Syncfusion Team April 21, 2020 02:40 PM UTC

Hi Genii,  

Thanks for contacting Syncfusion support.  

We want to inform you that the localization support for online demo and GitHub demo source will be available with our Volume 2, 2020 release scheduled at the end of June, 2020.  

We are also checking the issue reported regarding script error while loading resource of all components and the not changing the locale text randomly and get back to you with further details as earlier as possible. 

We expect your patience until then. 

Please get back to us if you need any further assistance on this.  

Regards, 
Jesus Arockia Sankaran S 



BR Brian April 22, 2020 02:35 AM UTC

Hi team,


Thanks for your attention. Till now, I have found some (maybe not all) flaws in SfResources.zh.resx source file, and I hope it can help if I submit it here for your reference:

line 337, there is an unnecessary double quote at the beginning, which caused the browser console error.
line 391, the same as above.
line 1185, the second format item {0} should be {1}.

Best regards.


JA Jesus Arockia Sankaran S Syncfusion Team April 23, 2020 02:17 PM UTC

Hi Genii, 

We are extremely sorry for your trouble.  

We are checking these issue now and we are grateful for the information. We will also look into it while validating this issue and get back to you with details as earlier as possible. 

We appreciate your patience until then. 

Regards, 
Jesus Arockia Sankaran S 



TA Tarik Alkathiri replied to Jesus Arockia Sankaran S April 23, 2020 11:14 PM UTC

Hi Genii, 

Sorry for the inconvenience. 

Query: Could you please supply a sample with Grid component work with Locale property work with "de", "fr-CH". and "zh"? 
 
We have prepared a sample for your reference with requested cultures that can be downloaded from the below link.  
 
 
We request you to add the “Key Value pair” of localization strings for the components used in the application from the GitHub localization resource files where we have localization resource details all components in culture wise.  
 
Query: Further more, I made a try to implant localization part of the sample project you supplied into syncfusion official big sample project which resides in "C:\Users\Public\Documents\Syncfusion\Blazor\18.1.0.42", it dose not work out too.  
 
We have already planned to give localization support for our demo site and will update you the timeline for this in two business day on April 21, 2020. 
 
Please get back to us if you need any further assistance on this.  
 
Regards, 
Jesus Arockia Sankaran S 


Thank you very much for the sample.


JA Jesus Arockia Sankaran S Syncfusion Team April 24, 2020 12:10 PM UTC

Hi Tarik, 

You are welcome and thank you for your update. 

Regards, 
Jesus Arockia Sankaran S 



JA Jesus Arockia Sankaran S Syncfusion Team May 7, 2020 07:20 AM UTC

Hi Genii,  

Thank you for waiting for our response and sorry for the delay in getting back to you.  

We have cleared the formatting issue in resource file (.resx) of Chinese culture (zh) and you can download it from the below link. 


We will intimate you once the GitHub repository is updated with latest changes.  

Please get back to us if you need any further assistance on this. 

Regards, 
Jesus Arockia Sankaran S 



MS Michael Sandler May 9, 2020 07:41 AM UTC

Hi,

I am getting the same errors using language DE and blazor server side. 
My version is 18.1.0.48 and i got the latest language files from github.
Attached is the log-file.

Thanks and regards



Attachment: sfloc_d53a5c3e.zip


BR Brian May 11, 2020 01:23 AM UTC

Thank you for that, I'll follow the improvement.


JA Jesus Arockia Sankaran S Syncfusion Team May 11, 2020 04:37 AM UTC

Hi Michael, 
 
Sorry for the inconvenience caused.  
 
We request you to use the below updated resource file for German culture until we refresh the GitHub repository with latest changes.  
 
 
We will intimate you once the GitHub repository is updated with latest changes.  
 
Regards, 
Jesus Arockia Sankaran S 



JA Jesus Arockia Sankaran S Syncfusion Team May 11, 2020 04:38 AM UTC

Hi Genii, 

Thank for your update. 

Regards, 
Jesus Arockia Sankaran S 



MS Michael Sandler replied to Jesus Arockia Sankaran S May 12, 2020 03:53 PM UTC

Hi Michael, 
 
Sorry for the inconvenience caused.  
 
We request you to use the below updated resource file for German culture until we refresh the GitHub repository with latest changes.  
 
 
We will intimate you once the GitHub repository is updated with latest changes.  
 
Regards, 
Jesus Arockia Sankaran S 


Hi,

The link is for the Chinese language and not for the german one. Please send me the correct file.

thanks and regards
michael


JA Jesus Arockia Sankaran S Syncfusion Team May 12, 2020 03:58 PM UTC

Hi Michael, 

Sorry for the inconvenience. 

Please find the resource file for the German culture. 

 
Regards, 
Jesus Arockia Sankaran S 




MS Michael Sandler May 13, 2020 12:47 PM UTC

Thanks, working like expected.

Regards michael


JA Jesus Arockia Sankaran S Syncfusion Team May 13, 2020 02:16 PM UTC

Hi Michael,  

You are more welcome and thank you for your update. 

Regards, 
Jesus Arockia Sankaran S 


Loader.
Up arrow icon