summaryrefslogtreecommitdiff
path: root/babel/support.py
diff options
context:
space:
mode:
Diffstat (limited to 'babel/support.py')
-rw-r--r--babel/support.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/babel/support.py b/babel/support.py
index 3efc003..50f2752 100644
--- a/babel/support.py
+++ b/babel/support.py
@@ -17,7 +17,7 @@ import locale
from babel.core import Locale
from babel.dates import format_date, format_datetime, format_time, \
format_timedelta
-from babel.numbers import format_decimal, format_currency, \
+from babel.numbers import format_decimal, format_currency, format_compact_currency, \
format_percent, format_scientific, format_compact_decimal
@@ -124,6 +124,13 @@ class Format:
"""
return format_currency(number, currency, locale=self.locale)
+ def compact_currency(self, number, currency, format_type='short', fraction_digits=0):
+ """Return a number in the given currency formatted for the locale
+ using the compact number format.
+ """
+ return format_compact_currency(number, currency, format_type=format_type,
+ fraction_digits=fraction_digits, locale=self.locale)
+
def percent(self, number, format=None):
"""Return a number formatted as percentage for the locale.