Localization not working on .net 7 Blazor WASM

I have built a Blazor WASM. Everything works. After many hours of searching blogs and so on.

Main control used is scheduler. Also some datagrids.

In scheduler i had to make my own editor, because the behaviour of the build-in editor is crazy and not as expected.

Now I want to localize the solution. I read all of your suggestions, but nothing works on the client.

AppName.Resources.SfResources.ResourceManager is not known. So it does'nt work. I did as you mentioned in your blog and documentation. But it seems that all of them is very old and not up-to-date.

AppName is an alias für the real name of the solution.

Do you have any solution?

Best regards

Thomas



3 Replies

VS Venkateshwaran Saravanakumar Syncfusion Team June 22, 2023 01:59 PM UTC

Hi Thomas,

UG :  https://blazor.syncfusion.com/documentation/common/localization

Based on your query, we have prepared a WASM Scheduler sample and used German as its static culture. Our sample localized correctly. Therefore, we were unable to reproduce the issue you mentioned. We suspect that you may not have used the default resx file (SfResources.resx) in your sample. If our assumption is correct, you need to include it in your Scheduler, and it will resolve your issue. Refer to the shared UG for more details. Let us know if you need any further assistance.

                      

Regards,

Venkatesh


Attachment: BlazorLocalization_398b926b.zip


TG Thomas Grobbauer June 23, 2023 08:16 AM UTC

Sorry, I tried this before. It does not work at all.

Here's my code:

using Syncfusion.Blazor;


namespace PlannerWebApp.Client.Shared

{

    public class SyncfusionLocalizer : ISyncfusionStringLocalizer

    {


        public string GetText(string key)

        {

            return this.ResourceManager.GetString(key);

        }


        public System.Resources.ResourceManager ResourceManager

        {

            get

            {

                // Replace the ApplicationNamespace with your application name.

                return PlannerWebApp.Client.Resources.SfResources.ResourceManager;

            }

        }

    }

}

There are also the normal Namespaces PlannerWebApp.Server and PlannerWebApp.Shared as Asp.Net hosted solution.

Error: The Type or namespace 'Resources' does not exist.

The Microsoft Localization is working well for other texts in the client project.





VS Venkateshwaran Saravanakumar Syncfusion Team June 26, 2023 05:57 PM UTC

Hi Thomas,

[with issue snip]


If you are encountering the error shown in the above snippet, our assumption is that it is due to the absence of the default ‘SfResources.resx’ file. To resolve this issue, you need to include the ‘SfResources.resx’ file under the Resources folder and change the access modifier of ‘SfResources.resx’ to public, as shown in the snippet below. Once you have made these changes, save the solution, and it should resolve the issue.



[without issue snip]


If you are unable to resolve the issue using this approach, kindly provide more details related to the issue. Let us know if we have missed anything in the prepared sample. Additionally, sharing a simplified sample that replicates the issue would greatly help us understand and resolve the problem.
 

Regards,
Venkatesh


Loader.
Up arrow icon