Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About NET5.0 Blazor WebAssembly Uses My.Extensions.Localization.Json #62

Closed
GreenShadeZhang opened this issue Jan 10, 2021 · 14 comments
Closed

Comments

@GreenShadeZhang
Copy link

A limited set of ASP.NET Core's localization scenarios are currently supported:

IStringLocalizer and IStringLocalizer are supported in Blazor apps.
IHtmlLocalizer, IViewLocalizer, and Data Annotations localization are ASP.NET Core MVC scenarios and not supported in Blazor apps.

When I use it, there's a Microsoft.AspNetCore.Mvc.Localization reference, so can this library separate the code so that NET5.0 Blazor WebAssembly works.

Also, can the name of this library be changed to a more formal name? The name gives a less formal feel.

@hishamco
Copy link
Owner

Hi @GreenShadeZhang I did some localization in Oqtane Framework (Blazor), I may look again into the JsonLocalizer

Also, can the name of this library be changed to a more formal name? The name gives a less formal feel.

I'm not sure if it's the right time, I followed the same naming convension of ASP.NET Core Extensions at the beginning, I think it's not a big issue while there's a tags attached on the NuGet package

Thanks

@GreenShadeZhang
Copy link
Author

Hi @GreenShadeZhang I did some localization in Oqtane Framework (Blazor), I may look again into the JsonLocalizer

Also, can the name of this library be changed to a more formal name? The name gives a less formal feel.

I'm not sure if it's the right time, I followed the same naming convension of ASP.NET Core Extensions at the beginning, I think it's not a big issue while there's a tags attached on the NuGet package

Thanks

Hello, have you tested some problems in the NET5.0 Blazor WebAssembly project?

@hishamco
Copy link
Owner

Sorry @GreenShadeZhang I was busy last few days, hope to do it today or tommrow, could you please create a minimal repo, so I can easily figure out the issue and test it

@GreenShadeZhang
Copy link
Author

Sorry @GreenShadeZhang I was busy last few days, hope to do it today or tommrow, could you please create a minimal repo, so I can easily figure out the issue and test it

https://github.com/GreenShadeZhang/BlazorAppTest

This is a NET5.0 Blazor WebAssembly test project, the main reason is to expose Microsoft.AspNetCore.Mvc namespace problems, I looked at the source code NET5.0 Blazor WebAssembly multi-language only used Microsoft.Extensions.Localization, your library is implemented razor page and mvc interface, I hope you'll help you see if you're going to leave the library alone for Blackzor Web Assembly or continue in compatibility mode.

@hishamco
Copy link
Owner

Thanks @GreenShadeZhang, I will have a look ...

@hishamco
Copy link
Owner

Seems I was wrong when I add Microsoft.AspNetCore.Mvc.Localization I will try to look to the commits history

@hishamco
Copy link
Owner

I figure out the issue, which came from introduing JsonHtmlLocalizer, so I will move into into another assembly, so Blazor will not complain then ...

@hishamco
Copy link
Owner

PR #46 is the main reason for this, a better solution is to create another package for MVC specific localization

@hishamco
Copy link
Owner

@GreenShadeZhang I just removed the dependency, hopefully I will release the upcoming release with few days, you could try GitHub Packages for now without waiting https://github.com/hishamco?tab=packages&repo_name=My.Extensions.Localization.Json please let me know if this fix your issue

@GreenShadeZhang
Copy link
Author

@GreenShadeZhang I just removed the dependency, hopefully I will release the upcoming release with few days, you could try GitHub Packages for now without waiting https://github.com/hishamco?tab=packages&repo_name=My.Extensions.Localization.Json please let me know if this fix your issue

When I use the package you remove, there will also be an error, as if it were an error caused by a resource path read, and it is recommended that you test it with the NET5.0 Blazor WebAssembly project.

image

@hishamco
Copy link
Owner

Please refer me to the page that causes the issue, I will try to update the blazor sample to NET5.0

@GreenShadeZhang
Copy link
Author

Please refer me to the page that causes the issue, I will try to update the blazor sample to NET5.0

Hello this time I test your code, I upgraded sdk to net5.0, managed in server mode, running your code is normal, but when I use WebAssembly to produce file read problems, the cause of the problem is that the json file read place blazor has adjustments, resulting in not being able to take the path to get jason files, this is my guess, I hope you have time also test, originally I intended to give a pr but I did not test successfully.

@hishamco
Copy link
Owner

Feel free to submit a PR if it's required, I will check the Blazor WebAssembly app too

@hishamco
Copy link
Owner

We update to .NET 7 reopen if you still facing the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants