-->

Using `ResHelper` to get resource string uses thre

2019-08-01 17:38发布

问题:

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

标签: c# kentico