问题
Using Kentico CMS with a multi culture site, we have custom code to get a resource string, when we use ResHelper.GetString("someKey")
it does not use LocalizationContext.CurrentCulture
version of the string, it is always defaulting to the US culture.
When I pass in the culture code to use as the second parameter using Localization.CurrentCulture.CultureCode
it returns the correct string?
Using a quick watch and breakpoint at the code, I can see that Thread.CurrentThread.CurrentCulture
and CurrentUICulture
are both set to US whilst LocalizationContext.CurrentCulture
is set to which ever version of the website we are viewing.
Why wouldn't Kentico set the Thread culture if resource strings rely on it?
We have used many resource strings throughout the site, some are using built in cms controls <cms:LocalizedLabel ResourceString="someKey" />
- how do these controls work?
Thanks
来源:https://stackoverflow.com/questions/42813808/using-reshelper-to-get-resource-string-uses-thread-culture-not-localizationcon