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

Blazor Desktop tenets: Global readiness #2532

Closed
Eilon opened this issue Feb 27, 2021 · 5 comments
Closed

Blazor Desktop tenets: Global readiness #2532

Eilon opened this issue Feb 27, 2021 · 5 comments
Assignees
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView

Comments

@Eilon
Copy link
Member

Eilon commented Feb 27, 2021

  • In general, globalization and localization
  • But also patterns for building apps that use these patterns. It is likely that both Blazor and the native UI platforms each have their own flavors of this, so we need to see how these fit into a single app.
  • Does each native WebView component have some of its own concerns/features we need to be aware of?
@ghost
Copy link

ghost commented Mar 1, 2021

Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@Eilon Eilon transferred this issue from dotnet/aspnetcore Sep 16, 2021
@Eilon Eilon added the area-blazor Blazor Hybrid / Desktop, BlazorWebView label Sep 16, 2021
@mkArtakMSFT mkArtakMSFT assigned pranavkm and unassigned Eilon Jan 19, 2022
@pranavkm
Copy link
Contributor

pranavkm commented Feb 1, 2022

I spent a bit of time working this out today.

To start with MAUI configures the CurrentCulture / CurrentUICulture based on the device's ambient information. Closest available docs are from Xamarin.Forms, but they apply to MAUI too https://docs.microsoft.com//xamarin/xamarin-forms/app-fundamentals/localization/text?pivots=windows#test-localization.

This allows IStringLocalized<> to work out of the box just the way our docs explain it. Similar globalization also works - all of the formatting / parsing / binding use the culture correctly.

Interestingly, .NET's resourcing system also supports embedding images as blobs in to the app which IStringLocalizer does not support. Even if a user were to read these images using ResourceManager, we currently don't have a component that allows rendering the retrieved Stream as an image.

In addition to this, there are platform specific ways to include localized images. This problem would apply to WebViews in general, but browser elements do not know how to do the interact with these systems. That said, I couldn't get this to work with my Android sample, I'm working on following up with devs on this if this is meant to work.

Dynamically changing the app culture at runtime is a bit interesting - in WASM, we expect the app to be reloaded if the culture changes. This take care of re-rendering the root component and flushing the new culture to child components. There are some instances of users trying this in their Xamarin.Forms apps which relies on triggering an event causing their app to re-render. A determined user could do something similar to re-render the root component in this case.

@pranavkm
Copy link
Contributor

@guardrex could I get some help with the docs for this? The plan is to document this as another pivot on the localization page of the Blazor docs: https://docs.microsoft.com/en-us/aspnet/core/blazor/globalization-localization?view=aspnetcore-6.0&pivots=webassembly?

@guardrex
Copy link
Contributor

We're going to have a focused Blazor Hybrid node, so we can have a topic on this there. I've added it to the tracking issue and cross-linked this issue for work.

Blazor Hybrid tracking
dotnet/AspNetCore.Docs#24956

@pranavkm
Copy link
Contributor

Thanks. I'll close this issue since we're already tracking work in the docs issue.

@ghost ghost locked as resolved and limited conversation to collaborators Mar 18, 2022
@mkArtakMSFT mkArtakMSFT added this to the 6.0.300-preview.14 milestone Mar 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView
Projects
None yet
Development

No branches or pull requests

4 participants