aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Ability to use user-selected or system culture in RequestLocalizationOptions

Open hishamco opened this issue 3 years ago • 14 comments

Fixes #44286

We faced an issue in OrchardCore, the current culture based on the user-selected culture all the time because CultureInfo called the default constructor with `useUserOverride

It would be nice if we can fix this behavior by adding a simple parameter to RequestLocalizationOptions that allow us to use whether to select user-selected culture or default system culture

/cc @DamianEdwards

hishamco avatar Sep 30 '22 16:09 hishamco

Thanks for your PR, @hishamco. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

ghost avatar Sep 30 '22 16:09 ghost

I just set the default value to true to avoid behavior breaking changes

hishamco avatar Sep 30 '22 16:09 hishamco

Thanks @hishamco. Can you log an issue for this please?

DamianEdwards avatar Sep 30 '22 17:09 DamianEdwards

Can I refer to the Orchard Core issue because it contains much details, otherwise I will file an issue here

hishamco avatar Sep 30 '22 17:09 hishamco

Seems it has been years since I contributed to localization after the repo becomes HUGE ;) Does the PublicAPI.Shipped auto generated or shall I need to modify it?

hishamco avatar Sep 30 '22 18:09 hishamco

There's a code fixer for it in Visual Studio so you should just be able to Ctrl+. to fix it.

DamianEdwards avatar Oct 01 '22 00:10 DamianEdwards

Is there another way to modify that file, I'm unable to do it from VS code the project is HUGE, my laptop is hanging ;)

hishamco avatar Oct 01 '22 07:10 hishamco

Docs don't seem to indicate another way: https://github.com/dotnet/aspnetcore/blob/main/docs/APIBaselines.md

You should only need to open a filtered solution (or even just a project) that contains the affected APIs and run it in the context of that though.

DamianEdwards avatar Oct 03 '22 15:10 DamianEdwards

I already opened the middleware solution, I will have a try

hishamco avatar Oct 03 '22 17:10 hishamco

Seems it doesn't work with I'm expecting that I need to install preview bits of .NET Core 8 version

hishamco avatar Oct 10 '22 08:10 hishamco

@hishamco the repo relies on bits installed locally to the repo. You should only need to run restore.cmd in repo root to get required bits.

DamianEdwards avatar Oct 10 '22 14:10 DamianEdwards

I got the following exception during the restore process

D:\Git\Repositories\aspnetcore\src\Servers\IIS\build\Build.Common.Settings(12,3): error MSB4019: The imported project " D:\Git\Repositories\aspnetcore.tools\msbuild\17.1.0\tools\MSBuild\Microsoft\VC\v170\Microsoft.Cpp.Default.props" was n ot found. Confirm that the expression in the Import declaration "D:\Git\Repositories\aspnetcore.tools\msbuild\17.1.0\t ools\MSBuild\Microsoft\VC\v170\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk. [D:\Git\Repo sitories\aspnetcore\src\Servers\IIS\AspNetCoreModuleV2\AspNetCore\AspNetCore.vcxproj]

Do I need a C++ packages? If this will take long, I can modify the APIs, after @halter73 reply on my comment in the original issue, then if some can modify the PublishedAPI file it will be helpful

Hope if we can merge this before shipping v7.0.0

hishamco avatar Oct 11 '22 17:10 hishamco

Hope if we can merge this before shipping v7.0.0

Unfortunately, it's far too late to merge any non-critical changes in .NET 7. This will have to wait until .NET 8.

I suspect you can build Localization.slnf without a C++ SDK, but the easiest thing to do is probably to follow our BuildFromSource doc and run ./eng/scripts/InstallVisualStudio.ps1. I think this should install all the necessary SDKs for .\restore.ps1 to complete successfully.

halter73 avatar Oct 11 '22 19:10 halter73

./build.cmd -nobuildnative should also work

BrennanConroy avatar Oct 11 '22 19:10 BrennanConroy

BTW @halter73 could you please doble check the APIs file coz I faced issue with VS, but I struggled to modify it

hishamco avatar Oct 21 '22 22:10 hishamco