[fpc-pascal] BoolToStr() with correct locale output
Graeme Geldenhuys
graemeg at opensoft.homeip.net
Fri Jun 26 19:05:22 CEST 2009
Henry Vermaak wrote:
>
> I think even for config/system files they are useless, since it's a
> lot more friendly to support yes/no, true/false and on/off, not just
> true/false.
Maybe that was the idea behind the TrueBoolStrs array. Element 0 is true/false, element 1 maybe yes/no, element 3 maybe on/off....? Either way, I did not find any documentation why there is an array used or what should actually be in it. The implementation of BoolToStr and StrToBool does give any clues either, because they always use element 0 or a hardcoded string value in English.
So I take it you agree with Vincent, that I should basically never user BoolToStr or StrToBool for user displayed values and rather duplicate the code in my own application which supports translated values? And then use the SysUtils version for config files or database stored value?
Again, nothing like this is hinted at in the documentation. I'll double check on Monday what the Kylix 3 help says regarding BoolToStr and StrToBool and localization and when it should actually be used.
Regards,
- Graeme -
________________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
More information about the fpc-pascal
mailing list