dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.46k stars 10.03k forks source link

IStringLocalizer<T> does not work in Blazor WASM #22825

Closed gbukauskas closed 4 years ago

gbukauskas commented 4 years ago

Interface IStringLocalizer displays translated messages from English resource file only (project Blazor WASM). I published on google.drive archyve with: 1) Sample application ClickoApp, 2) Screenshots (Fig_1 - Fig_3), 3) Description how to reproduce an error 'Steps for reproduce.docx' Use link https://drive.google.com/file/d/1GsftEqb_sDLfr3LnJQq1bmSKEPHOAXLi/view?usp=sharing for downloading the archive

pranavkm commented 4 years ago

Thanks for the issue report @gbukauskas. We think this might be an issue with your application and this question is better suited for StackOverflow. Our docs for localization are covered by https://docs.microsoft.com/en-us/aspnet/core/blazor/globalization-localization?view=aspnetcore-3.1. If you think it's an issue with the framework, please file a new issue demonstrating the problem and we will investigate.

gbukauskas commented 4 years ago

I created application following link that you have mentioned. English resource 'Shared.NavMenu.en.resx' works, all other languages - no. Read yourself the document. It says: The following example shows how to set the current culture in a cookie that can be read by the Localization Middleware. Create a Razor expression in the Pages/_Host.cshtml file immediately inside the opening tag: It applicable for Blazor server-side only. WASM has no middleware nor _Host.cshtml. Well, keep the bug closed if you wish, someone will report it again. It doesn’t matter to me because I found a working i18n solution on WEB (https://dev.to/j_sakamoto/how-to-localize-texts-in-your-blazor-app-phn ).

Gediminas Bukauskas

2020-06-11, kt, 19:35 Pranav K notifications@github.com rašė:

Closed #22825 https://github.com/dotnet/aspnetcore/issues/22825.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dotnet/aspnetcore/issues/22825#event-3435018505, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADHFL2J246I2WJDP5DHHDTRWEBW5ANCNFSM4N3RTPSA .

-- Gediminas Bukauskas SKYPE: gediminasbuk Phone: +370 37 793622 Mobile: +370 611 31090 E-mail: gbukauskas@gmail.com