Culture Specific Currency for a given culture

Viewed 312

So I was working on a website and I was using the following Javascript code

UsdAmount.toLocaleString(siteCulture,
      {style: 'currency', currency: 'USD'})
CadAmount.toLocaleString(siteCulture,
      {style: 'currency', currency: 'CAD'})

And it was working fine with expected results

So that

Culture     Currency    Output
en-us       USD         $123.45
en-us       CAD         CA$123.45
en-ca       USD         US$123.45
en-ca       CAD         $123.45

But this function does not work in Safari, therefore I can not use it.

So I figure I will just do it on the server side in C# and pass the string

But that does not seem to work for two reasons

  1. I can't pass two cultures, a system culture and a currency culture
  2. Doesn't seem to work any way since

    4.ToString("C", new CultureInfo("en-us")) ==> "$4.00"
    4.ToString("C", new CultureInfo("en-ca")) ==> "$4.00"  // No CA$
    

So anyother ideas on formatting currency that works across all browsers?

1 Answers
Related