Determine programmatically global language and installed language packs in SharePoint 2010

A little known class in SharePoint Server Object Model is Microsoft.SharePoint.SPRegionalSettings, but it is exactly there, where some useful info about local (site) and global (farm) regional settings can be found.

For example, to determine the original language in which SharePoint farm was installed, you would write something like:

SPLanguage globalLanguage = SPRegionalSettings.GlobalServerLanguage;

There you can find the name and the locale of the global language. Similar to that, to get info about the lanuage packs, you would use:

SPLanguageCollection languagePacks = SPRegionalSettings.GlobalInstalledLanguages;

Note that the “GlobalInstalledLanguages” collection also contains the default language, not only language interface packs.

But there is much more to the SPRegionalSettings, you would be surprised what can be found there – just take a look at

http://msdn.microsoft.com/en-us/library/ms461103