Scope: Net Framework 4.8 migration to Net Core 5 migration project for an application deployed on prem at a large amount of customers (asp.net).
The current application lets users change all texts, messages etc themselves, they can e.g. translate everything to polish and store this under language "PO" they can also only change some sentences for some screens or some error messages and save this as "X2". (stored in SQL /EF). Every user can set their own preferred languageset and add custom ones. By default however always English and another language are provided as standard, and all custom ones derive from that (coalesce)
We scanned the application and we wanted to follow best practice and use the ASPNETCORE5 Localization features.
When using a CustomRequestCultureProvider we fetch the LanguageId from the token / cache for the user since currently the language is passed in this way. This should deliver a culture from new ProvideCultureResult. This is also with an eye on the future to provide more culture capabilities than only translation of strings (currently entailing (error)messages, screenlabels, model properties AND the content of the properties where applicable, enums, etc).
Assumption is here (and of that am i not sure) that while CRUD-ing the specific language it will need a new culture indication and thus something like a culture creation for the language (only language is changed no other aspects of the application including , . etc) but only when doing the AddInitialRequestCultureProvider so ... localization ... since only during a session it is needed to have it as culture. (and every customer application has their own languages).
OR ... do not use ProviderCultureResult but always create a new culture on the fly with the only reasons to fetch the id and use localizer and have this ready for further improvements in the future.
Basically we never use the culture aspects we only need the string. But the localizer etc... are all around culture.
Is this correct?
question from:
https://stackoverflow.com/questions/66048210/aspnet-core-customrequestcultureprovider-with-various-custom-languages 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…