backport from bluebream version: number formatting with pattern
This commit is contained in:
parent
a528e6f4af
commit
a552ba224c
1 changed files with 3 additions and 2 deletions
|
@ -50,10 +50,11 @@ def formatDate(dt=None, type='date', variant='medium', lang='de'):
|
|||
return fmt.format(dt or datetime.now())
|
||||
|
||||
|
||||
def formatNumber(num, type='decimal', lang='de'):
|
||||
def formatNumber(num, type='decimal', lang='de', pattern=u'#,##0.00;-#,##0.00'):
|
||||
loc = locales.getLocale(lang)
|
||||
fmt = loc.numbers.getFormatter(type)
|
||||
return fmt.format(num)
|
||||
return fmt.format(num, pattern=pattern)
|
||||
|
||||
|
||||
|
||||
def toStr(value, encoding='UTF-8'):
|
||||
|
|
Loading…
Add table
Reference in a new issue