I would like to display Yes/No in different languages according to some boolean variable.
Is there a generic way to format it according to the locale passed to it?
If there isn’t, what is the standard way to format a boolean besides boolVar ? Resources.Yes : Resources.No.
I’m guessing that boolVar.ToString(IFormatProvider) is involved.
Is my assumption correct?
I would like to display Yes/No in different languages according to some boolean variable.
Share
The framework itself does not provide this for you (as far as I know). Translating
true/falseintoyes/nodoes not strike me as more common than other potential translations (such ason/off,checked/unchecked,read-only/read-writeor whatever).I imagine that the easiest way to encapsulate the behavior is to make an extension method that wraps the construct that you suggest yourself in your question:
Usage: