In SharePoint 2010 you have the ability to configure alternate languages for a website, this feature enables that navigation and labels are presented in the user selected language without creating variations, when on a farm multiple language pack’s are deployed you can configure Alternate Languages on every site.
Configure Multilangual User Interface
1. goto site settings –> Language Settings
2. select the languages of choise.
3. press OK to save changes.
Change Language on Site
The language of the current site can be changed by slecting the ‘Select Display Language’ in the user menu
Using Labels in your solution
When you want to use different languages in your custom solutions it is possible to make use of resource files withing SharePoint.
The SharePoint object model provides Helper methods to get localized strings, the following article on MSDN explains how to use this: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.getlocalizedstring.aspx
Get current language of user
With SPWeb.Language you get the ‘default’ language of the site in the case of alternate languages it is not sufficient to use this because a user could have set the language to a non ‘default’ language.
The current language of a user can be found at: CultureInfo.CurrentUICulture.LCID
The following Helper method can be used to retrieve localized strings with respect to the user selected language.
public static string GetResourceString(string resourceName, string name)
int languageId = 1033;
if (SPContext.Current != null && SPContext.Current.Web != null)
//Set Language to default language of web object! languageId = (int)SPContext.Current.Web.Language;
//if alternate language is selected by user! if (SPContext.Current.Web.IsMultilingual &&
SPContext.Current.Web.SupportedUICultures.Where(w => w.LCID == CultureInfo.CurrentUICulture.LCID).
languageId = CultureInfo.CurrentUICulture.LCID;
return SPUtility.GetLocalizedString(resourceName, name, (uint)languageId);