I have a multilanguage site. I want this site to display prices only in Danish kronam not depending on what language is actually chosen. In order to achieve this I tried following
var currentCulture = new CultureInfo(CultureInfo.CurrentCulture.Name); currentCulture.NumberFormat.CurrencySymbol = "kr"; currentCulture.NumberFormat.CurrencyPositivePattern = 3; currentCulture.NumberFormat.CurrencyNegativePattern = 3; CultureInfo.DefaultThreadCurrentCulture = currentCulture; CultureInfo.DefaultThreadCurrentUICulture = currentCulture;
inside initialization module:
[InitializableModule]public class FilterConfig : IConfigurableModule
After executing the code CultureInfo.Current culture shows correct CurrencySymbol, but when I'm accessing the page it falls back to one that correspond current language. What am I doing wrong?
I have two sites both added in episerver admin with different cultures.
If I use:
var currentCulture = new CultureInfo(System.Globalization.CultureInfo.CurrentCulture.Name);
var symbol = currentCulture.NumberFormat.CurrencySymbol;
symbol will change depending on culture set on your site.
Not sure why you need to do this in a InitializableModule? I might have missed something :-)
No, I suppose I'm doing this incorrectly. Initialize module is really not the best place. But I want to change this thing in a culture automatically in order just to call .ToString("c")