Reputation: 1812
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.
Upvotes: 1
Views: 5111
Reputation: 4783
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
Upvotes: 0
Reputation: 56
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
Upvotes: 0
Reputation: 1037
Starting from Blazor Web Assembly preview 4 localization works. This article shows how to localize a Web Assembly Blazor application.
Upvotes: 0
Reputation: 1812
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.
Upvotes: 1