There isn't a library-based solution to your question, nor should there be. The reason is that a string representation of System.Boolean
is unlikely to be useful for anything but the most trivial of localization. Note that is not the case for floating-point numbers where a culture-specific .
or ,
can be applied when formatting. Dates (System.DateTime
) have some localization support from the operating system itself, so .NET is able to build on that; this is not the case for System.Boolean
.
Usually, there will be other words in addition to just "True" (or "False"); those words will have to be translated too. And, depending on the language and those other words, you might not be able to do simple string concatenation: string message = baseMessage + b.ToString();
Instead, you should store your strings in resource files and retrieve the right one.
bool b = ...;
string message = b ? Properties.Resources.TrueMessage : Properties.Resources.FalseMessage;
See How to use localization in C# for more details.