[Mono-list] About Format Function (VB.NET)
Miguel de Icaza
miguel@ximian.com
19 Feb 2003 00:59:50 -0500
hello!
> Currently, i'm developing code into Microsoft.VisualBasic
> (FileSystem.cs and Strings.cs). Just now i am writing some code to
> "unstub" the Format function from Strings.cs. I've found a problem in
> which I don't know what to do:
>
> Format has two parameters : first, the object that you want to format
> (numbers,dates, etc), and second (style) an string explaining the format
> (for instance,Format(5,"00") will return the string "05". Well, one of
> the "styles" is "On/Off". MSDN library says that it returns the string
> "Off" if a number is equals to zero,and "On" if the number is not equal
> to zero.
>
> I've been testing it using Microsoft .NET, and to my surprise, in my
> spanish windows box, it returns "Activado" (that means "On" in
> Spanish") and "Desactivado" ("Off", in spanish).MSDN doesn't say any
> more about this.
>
> I've been looking into System.Globalization, cause I thought there
> could be something like an universal symbol to translate "On" and "Off",
> but I didn't find anything.
>
> I think this "multilanguage implementation" can be a real problem for a
> developer, for instance :
>
> An Spanish developer writes something like :
>
> if ( Format(myvar,"On/Off" == "Activado" )
> {
> ...
> }
My take is that they intended Format strings to be used for user
consumption, and not something that the program would have to
parse/consume.
For now you can just use On/Off, and later, when we do a pass for
localization, the strings will be translated appropriately.
Every other internationalized application has this issue ;-)
Miguel