Setting the Culture and Language

If your code runs outside the context of Microsoft Windows SharePoint Services and calls into the SharePoint object model, when the code executes, the culture of the current thread is set according to the settings of the operating system on the computer. To interact with Windows SharePoint Services, the current UICulture and Culture values must be set to the values contained respectively by the Language and Locale properties of the SPWeb class.

Use the CurrentUICulture property to specify the language text to load and the CurrentCulture property to specify the formatting of numbers, date/time values, and so on. Following is an example of how to set these properties:

System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("de");
System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");

In this example, the CultureInfo constructor requires that a using directive (Imports in Microsoft Visual Basic) be included for the System.Globalization namespace.