Revision #2 has been created by thelfensdrfer on Feb 20, 2012, 1:54:33 AM with the memo:
« previous (#1) next (#3) »
How to extend CFormatter, add i18n support to booleanFormat and use it in CDetailView
CDetailView, CFormatter, translation, i18n, boolean, view
In this case, the formatBoolean() method of the class CFormatter will be applied to th
a attribute value (see the [class reference](http://www.yiiframework.com/doc/api/1.1/CFormatter#formatBoolean-detail "") for details). This essentially replaces 0 with a 'No', and 1 with a 'Yes', which looks much nicer.
To be exact: the class CFormatter has a public property named `booleanFormat` which defaults to `array('No', 'Yes')`. The `formatBoolean()` method replaces a 0 with its first element, and a 1 with its second element.
If the application language is different from english, say german, it would look much nicer if 0 became 'Nein' and 1 became 'Ja'. The first thing that comes to (my) mind is to override the `booleanFormat` property in the config file like this: