-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Introduce DefaultCultureAliasProvider #18463
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel this approach might be a bit overengineered. I’d suggest simply moving the functionality into the actual interface implementation and removing the static method from the interface. This would eliminate the need for the new CultureInfoWrapper class, which introduces additional complexity, especially with its use of async local ShellScope, which raises performance concerns.
Additionally, I’m not convinced that introducing an ICultureAliasProvider is necessary at this stage. It seems like an abstraction that doesn’t yet provide enough value to justify its inclusion.
I might agree, but don't forget that we have two implementations for
If you look at the current localization APIs, there's already a rules provider, which might not be necessary, but it's good for flexibility and extensibility @Skrypt, I forgot to ping you while you were doing many things in localization |
|
as for me - this satisfies my need to add custom localization. Code looks good, and definitely cleaner than before :) |
I don’t think this is a major issue for such a small feature, but if needed, it could be implemented once as a static helper. |
I agree, but as you know, there's no service locator pattern in OC AFAIK, that's why I'm using |
|
I agree with @gvkries that the only change to do should be to convert this static method to one in the interface that can be implemented and customized wholly. The change should be very simple, and whatever was invoking the static method can now resolve the service directly. No need for a CultureWrapper either. |
|
To be clear, no need for ICultureAliasProvider either, the GetAllCultureAndAliases will return the union. If people want to change the aliases, they change GetAllCultureAndAliases. |
|
I never mind, but don't forget that we have two implementations, so no need to duplicate the code twice; moreover, customizing the aliases might be a headache. FYI, we already have similar approaches in |
|
We do not expect that this has to be customized regularly and therefore it does not need to be another abstraction inside OC. |
I didn't expect further customization in while OC is extensible from the ground up, let us do it the way that it should |
|
@hishamco it is abstracted. You can replace the whole implementation of the method. You even prove it by saying it will be duplicated in two implementations. We just don't need to split this method in two more concepts. Someone who doesn't want to see these aliases can replace the method. Someone who doesn't want to list the .NET cultures can replace it. |
|
I agree with you, may issue that I will find myself duplicating the code on both current implementations, if it's fine, I will update the PR ASAP |
Fixes part of #18455
/cc @MikeKry