python-babel / babel

The official repository for Babel, the Python Internationalization Library
http://babel.pocoo.org/
BSD 3-Clause "New" or "Revised" License
1.29k stars 433 forks source link

Unable To Get Currency Code for NPR (Nepali Rupee) #1021

Closed ramchandra-st closed 2 months ago

ramchandra-st commented 11 months ago

Overview Description

Steps to Reproduce

  1. import function: from babel.numbers import get_currency_symbol
  2. Try printing Nepali Rupee: print(get_currency_symbol('NPR')) # I've not any locale info
  3. Result: It shows 'NPR' instead of रू

Actual Results

Expected Results

Reproducibility

Additional Information

akx commented 2 months ago

If you do not request a locale when using get_currency_symbol(), Babel will use your current ambient monetary locale. It's quite possible that locale (we can't tell what it is) says Nepali Rupees should be formatted as NPR.

For instance, as a Finn I wouldn't understand e.g. 1023रू to mean Nepali rupees, but with NPR 1023 I do stand a chance.