Display local default currency on Ionic app

Hi, how do I display local currency symbols in Ionic v3? I want US users should see prices with $ sign, UK users should see the pound sign, Japanese users the Yen symbol, etc. How can I achieve that?

I tried {{ amount | currency }} with amount=200, but it showed USD200 instead of $200. I want it to show the user’s local currency symbol.
I’ve searched all over Google, but no luck. I even checked the cordova globalization plugin, but it looks like you have to know the currency code (USD) to display the symbol.

Thanks.

Hi. Not exactly what you need but I guess it may help a bit:

Angular curency pipes are not precisely that friendly and reliable.
Best regards.
J

Thanks, but it didn’t help much. It shows how to format the currency, but I need something to detect the user’s location, and based on that, format to the right currency. I may just end up reading from a JSON list of all countries & currencies.

Thanks again.

Hi @obinnae, did you find anything for the same yet as I am trying to resolve the same problem in my app.

Thanks :slight_smile:

I ended up adding a JSON file containing currency codes & symbols, then selecting the right symbol based on the user’s country (which they entered manually). Here’s a sample of the file (for US dollar)

{"USD": {
    "name": "US Dollar",
    "fractionSize": 2,
    "symbol": {
      "grapheme": "$",
      "template": "$1",
      "rtl": false
    }
  }
}

Hope this helps. Good luck.