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

Can we have more details for the note, please? #33077

Closed
voroninp opened this issue Jul 15, 2024 · 11 comments · Fixed by #33100 or #33107
Closed

Can we have more details for the note, please? #33077

voroninp opened this issue Jul 15, 2024 · 11 comments · Fixed by #33100 or #33107

Comments

@voroninp
Copy link
Contributor

Description

[Enter feedback here]
There's a note:

Always set DefaultThreadCurrentCulture and DefaultThreadCurrentUICulture to the same culture in order to use IStringLocalizer and IStringLocalizer.

This is nice, but it does not provide the explanation of why? String localizer should use CurrentUICulture exclusively, why does it need CurrentCulture as well?

Page URL

https://learn.microsoft.com/en-us/aspnet/core/blazor/globalization-localization?view=aspnetcore-8.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/globalization-localization.md

Document ID

d6f07538-228e-9f96-680f-6c324caf11d6

Article author

@guardrex

Copy link
Contributor

😎🏖️🌴 Summertime! 🏐🏄‍♀️🦩

Stand by! A green dinosaur 🦖 (guardrex) will arrive shortly to assist.

@guardrex
Copy link
Collaborator

Hello @voroninp ... Yes, I think the NOTE should explain it.

First, let's cross-ref the source for the WASM culture provider ...

https://github.com/dotnet/aspnetcore/blob/main/src/Components/WebAssembly/WebAssembly/src/Hosting/WebAssemblyCultureProvider.cs#L65

Here are the docs PR and PU issue cross-links related to this ...

Although the PU issue closed out on the reason from Jeff that ...

"because Blazor WebAssembly is a UI framework, I would expect both CurrentCulture and CurrentUICulture to be the same"

I don't follow that reasoning. I wouldn't necessarily expect them to be the same.

I don't understand the thinking behind this line of the provider where only the CurrentCulture is used ...

https://github.com/dotnet/aspnetcore/blob/main/src/Components/WebAssembly/WebAssembly/src/Hosting/WebAssemblyCultureProvider.cs#L65

@hishamco ... Do you know why (or can you guess why) this limitation actually exists beyond that 'resources won't load properly'?

@voroninp
Copy link
Contributor Author

Yes, indeed strange they are using CurrentCulture to load resources.

@voroninp
Copy link
Contributor Author

We in our company started writing special comments with categories: Decision, Hack, Assumptions, etc.
We currently do not generated docs for them but we have plans to do so. I've seen many places in the sources of .NET where such comments would be precious and coud add valuable insights to the coumentation.

Inspired by this book https://www.oreilly.com/library/view/living-documentation-continuous/9780134689418/

@guardrex
Copy link
Collaborator

For that suggestion, it would go to 👉 https://github.com/MicrosoftDocs/feedback/issues.

@guardrex
Copy link
Collaborator

Received an update from Steve on this: He thinks this might be a bug. He's going to let me know if I should open a new issue on it or if the original PU issue that was closed should be re-opened for work.

In the meantime, I'll see about adding remarks on this when I reach this issue for work.

@voroninp
Copy link
Contributor Author

What is PU?

@guardrex
Copy link
Collaborator

guardrex commented Jul 15, 2024

"product unit"

@hishamco
Copy link
Member

I did write the note, but I think this is important for WebAssembly only to set the proper culture resources to be loaded, and no need to set that on the server

@guardrex
Copy link
Collaborator

Steve thinks it sounds like a bug. Either he'll re-open that issue from 2020, or I'll open a new one over there. I'll ping you on it either way so you can keep an 👁️ on it.

@guardrex
Copy link
Collaborator

I'll try to repro the behavior and give them a sample app for that PU issue ☝️ soon ... either today or tomorrow.

In the meantime, I'll try to resolve this issue for now by adding a cross-link to the PU issue.

Since I'm tracking on the PU issue, I'll see when/how they deal with it and open a new docs issue later for an additional update, which we hope will be to remove the notes and remark in passing that it is OK to set the current and current UI cultures to different values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
4 participants