We have a multisite and multilingual project. We upgraded it from Sitecore 8.1 to Sitecore 9.3. On one of the pages, we show prices e.g., $ 250.90. Before the upgrade, the site used to show currency symbol before the price - $ 250.90. But after the upgrade, it shows after the price - 250.90 $.

The logic to display the price with currency symbol takes the NumberFormatInfo object from the CultureInfo of the context language and uses this number format to determine the position of the currency symbol as per the NumberFormatInfo.CurrencyPositivePattern property.

public static string FormatDoubleAsCurrency(this double amount, Language language, string currency)
NumberFormatInfo nfi = language == null
? (NumberFormatInfo)Sitecore.Context.Language.CultureInfo.NumberFormat.Clone()
: (NumberFormatInfo)language.CultureInfo.NumberFormat.Clone();

nfi.CurrencySymbol = GetCurrency(currency);
return string.Format(nfi, "{0:c}", amount);

Can anybody please suggest what is the recommended way to handle this? Can the numberformat/cultureinfo be changed in Sitecore or does it require code change? If code change is required, please suggest a clean way to do it.

Thanks in advance!

  • 1
    probably, the easiest solution is to specify CurrencyPositivePattern manually (in your case it should be set to 2, you can check it in docs. To investigate the issue, maybe try to ensure, the culture is the same after upgrade. and also you can debug and compare CurrencyPositivePattern value. but with code changes, I would suggest the following: nfi.CurrencyPositivePattern = 2; Mar 28, 2022 at 15:45
  • @IgorZharikov Thank you for your answer. Is there any better way to do this?
    – NewbieHere
    Mar 29, 2022 at 9:50


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.