Best way to localized applications in .NET 2.0  
Author Message

PostPosted: .NET Base Class Library, Best way to localized applications in .NET 2.0 Top


I would like to ask you what is the best way to localize applications in .NET 2.0 and
how Microsoft do it in Vista


.NET Development27  
Peter Ritchie

PostPosted: .NET Base Class Library, Best way to localized applications in .NET 2.0 Top

There isn't a high percentage of .NET applications included with Vista.

Generally, with Visual Studio, you set a Form's Localizable property to true and you can then add text for each language you want to support in the resources. The Designer generated code will get the text from the resources with a ResourceManager object and will get the text that matches the users currently set culture or the text marked as the invariant.

When formatting/parsing data you can either use the default settings (which is to accept the user's culture settings) or override that by providing a IFormatProvider argument to methods like ToString, Format and Parse. The generally accepted practice is to use CultureInfo.CurrentCulture as the IFormatProvider argument when you need to display formatted data to the user and to use CultureInfo.InvariantCulture when converting to/from textual information that isn't displayed to the user (e.g. internally communicated data represented as text...). E.g.:

Double value;

Debug.Assert(true == Double.TryParse(textLoadedFromFile, NumberStyles.Float, CultureInfo.InvariantCulture, out value));


if (false == Double.TryParse(textInputByUser, NumberStyles.Float, CultureInfo.CurrentCulture, out value))


// TODO: better message

MessageBox.Show("Input not in valid format.");