Revision #7 has been created by c@cba on Aug 1, 2012, 5:05:55 PM with the memo:
added related links. edited first paragraph (visible as summary in wiki-list) is clearer.
« previous (#6) next (#8) »
Changes
Title
unchanged
Custom Number Formatting or Decimal Separators and i18n
Category
unchanged
Tutorials
Yii version
unchanged
Tags
unchanged
decimal separator, number format, i18n, customize, floating point numbers, localization
Content
changed
By default, the decimal separator in php (also in mysql) is a dot (.).
So when we work with floats in Yii (in calculations, validation, sql statements etc.), the decimal separator has to be a dot.
If we want to use for example a comma (,) as the decimal separator
in our application, that is if we want to display numbers and enable users to enter numbers with a comma before the decimals, we have to
:...
1. format the float value before printing/echoing : handle the output : 4.45 => "4,45"[...]
```
Related Links
-------------
- Wiki: [How to handle decimal separators (e.g comma instead of dot) for l18n](http://www.yiiframework.com/wiki/298/how-to-handle-decimal-separators-e-g-comma-instead-of-dot-for-l18n "How to handle decimal separators (e.g comma instead of dot) for l18n")
- Forum: [Handling decimal separators](http://www.yiiframework.com/forum/index.php?/topic/28048-handling-decimal-separators-wiki-article/ "Handling decimal separators")
- Extension: [decimali18nbehavior](http://www.yiiframework.com/extension/decimali18nbehavior "decimali18nbehavior")
- Wiki: [How to extend CFormatter, add i18n support to booleanFormat and use it in CDetailView](http://www.yiiframework.com/wiki/305/how-to-extend-cformatter-add-i18n-support-to-booleanformat-and-use-it-in-cdetailview/ "How to extend CFormatter, add i18n support to booleanFormat and use it in CDetailView")
That's it. If something is unclear, wrong or incomplete, please let me know. Any suggestions for improvements will be appreciated!