fix number formatting function
This commit is contained in:
		
							parent
							
								
									57cade3cf3
								
							
						
					
					
						commit
						a528e6f4af
					
				
					 2 changed files with 4 additions and 6 deletions
				
			
		|  | @ -1,5 +1,5 @@ | ||||||
| # | # | ||||||
| #  Copyright (c) 2007 Helmut Merz helmutm@cy55.de | #  Copyright (c) 2013 Helmut Merz helmutm@cy55.de | ||||||
| # | # | ||||||
| #  This program is free software; you can redistribute it and/or modify | #  This program is free software; you can redistribute it and/or modify | ||||||
| #  it under the terms of the GNU General Public License as published by | #  it under the terms of the GNU General Public License as published by | ||||||
|  | @ -18,8 +18,6 @@ | ||||||
| 
 | 
 | ||||||
| """ | """ | ||||||
| Some simple standard formatting routines. | Some simple standard formatting routines. | ||||||
| 
 |  | ||||||
| $Id$ |  | ||||||
| """ | """ | ||||||
| 
 | 
 | ||||||
| from zope.i18n.locales import locales | from zope.i18n.locales import locales | ||||||
|  | @ -54,7 +52,7 @@ def formatDate(dt=None, type='date', variant='medium', lang='de'): | ||||||
| 
 | 
 | ||||||
| def formatNumber(num, type='decimal', lang='de'): | def formatNumber(num, type='decimal', lang='de'): | ||||||
|     loc = locales.getLocale(lang) |     loc = locales.getLocale(lang) | ||||||
|     fmt = de.numbers.getFormatter(type) |     fmt = loc.numbers.getFormatter(type) | ||||||
|     return fmt.format(num) |     return fmt.format(num) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,8 +2,6 @@ | ||||||
| Basic Formatting Functions | Basic Formatting Functions | ||||||
| ========================== | ========================== | ||||||
| 
 | 
 | ||||||
| $Id$ |  | ||||||
| 
 |  | ||||||
|   >>> from cybertools.util import format |   >>> from cybertools.util import format | ||||||
|   >>> from datetime import datetime |   >>> from datetime import datetime | ||||||
| 
 | 
 | ||||||
|  | @ -15,3 +13,5 @@ $Id$ | ||||||
|   >>> format.formatDate(time, type='dateTime', variant='medium') |   >>> format.formatDate(time, type='dateTime', variant='medium') | ||||||
|   u'21.08.2006 17:37:13' |   u'21.08.2006 17:37:13' | ||||||
| 
 | 
 | ||||||
|  |   >>> format.formatNumber(17.2) | ||||||
|  |   u'17,2' | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue