1
votes

I am trying to implement localization for a Blazor WebAssembly app. I followed the example referred in the Documentation. I created the .resx files as per the example but my Blazor WebAssembly app does only show the string for the default .resx file ignoring the .resx files for the individual cultures. In the Documentation referred above I read:

By default, Blazor's linker configuration for Blazor WebAssembly apps strips out internationalization information except for locales explicitly requested. For more information and guidance on controlling the linker's behavior, see Configure the Linker for ASP.NET Core Blazor.

Following this last link I tried adding the following under my project file <PropertyGroup>

<MonoLinkerI18NAssemblies>all</MonoLinkerI18NAssemblies>

However this doesn't seem to work and on my Blazor WebAssembly app I am not able to see the localized text, I can only see the text for the default .resx file.

4
Can you provide a repo for this so someone can take a look?Mister Magoo
in development it shows the default , try to browse with another browser simultaneously with two browsers , the second browser will send culture infoטאבו ישראל שרות לקוחות

4 Answers

1
votes

This should be fixed on the next release of Blazor, preview 4. This has been confirmed by the author of the example in a github issue. The article in the documentation was published a little too early but this should be fixed shortly when the Blazor preview 4 is released.

0
votes

Starting from Blazor Web Assembly preview 4 localization works. This article shows how to localize a Web Assembly Blazor application.

0
votes

No need to use .resx files any more. They are a little huge because of their XML structure.

Try this plugin, it's just awesome and it uses YAML instead of XML which makes the file much lighter and also there is an online tool associated with it that let's you translate your files using Microsoft Translator and Azure.

https://akmultilanguages.azurewebsites.net

https://github.com/aksoftware98/multilanguages

0
votes

This project https://github.com/enkodellc/blazorboilerplate has full localization for both WebAssembly and Server-side Blazor using the Microsoft.Extensions.Localization libraries. It does use Po files vs resx. Here is the documentation: https://blazor-boilerplate.readthedocs.io/en/latest/quickstarts/localization.html