I've been going crazy trying to find where I can access the Locale found by going to your username at the top right of SharePoint -> My Settings -> My Regional Settings

I've been able to access Theme by using this code:
// Get data from SharePoint.
SPWeb web = SPContext.Current.Web;
SPList siteUserInfoList = web.Site.RootWeb.SiteUserInfoList;
SPUser user = web.CurrentUser;
SPListItem currentUserItem = siteUserInfoList.GetItemById(user.ID);
string theme = (string)currentUserItem["Theme"];
//string locale = web.Locale.Name;
//string locale = web.Site.RootWeb.Locale.Name;
//string locale = (string)currentUserItem["Locale"];
At the bottom of that code snippet, you can see three attempts at retrieving Locale, but they do not work. Any help is appreciated; I've been wasting a lot of time not finding much with foreach loops through all the SPList, SPListItem, etc objects... :(
* Feb 3, 2011 *
Code is pointed out in James Love's answer below for successfully retrieving Locale from "My Regional Settings".
However, this only works when "Always follow web settings" is NOT checked for Follow Web Settings. (See top of attached picture.)
// Get the locale.
string locale = "a";
try
{
CultureInfo ci = new CultureInfo((int)web.CurrentUser.RegionalSettings.LocaleId);
locale = ci.Name;
}
catch
{
try { var locale2 = web.CurrentUser.RegionalSettings.LocaleId; }
catch { locale = "en-US"; };
}
The code where I have var locale2 will fail if "Always follow web settings" is checked, but otherwise it will work. That means that in the outermost catch block, I should set my locale variable to something else. I just need to find out where to access the overall locale settings.
(Except when it's a call into COM code)
– Andy Burns Feb 03 '11 at 09:33