Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Scenario: Running SharePoint 2010 with the Hebrew language pack installed. On a particular site, English is set as the default language, but Hebrew is available for users as an Alternative Language.

Issue: In C# on a custom project, how can I identify when a user has selected a right to left language as their alternative language?

The following all return false:

  1. SPContext.Current.RegionalSettings.IsUIRightToLeft
  2. SPContext.Current.RegionalSettings.IsRightToLeft
  3. SPContext.Current.Web.RegionalSettings.IsUIRightToLeft
  4. SPContext.Current.Web.RegionalSettings.IsRightToLeft

And these return null:

  1. SPContext.Current.Web.CurrentUser.RegionalSettings.IsUIRightToLeft
  2. SPContext.Current.Web.CurrentUser.RegionalSettings.IsRightToLeft

Any ideas?

share|improve this question
    
To clarify: I need the best way to 1) identify if the default language is RTL -and- 2) identify if the selected alternative language is RTL. Thanks! –  John Chapman Jun 15 '12 at 17:19
add comment

1 Answer

up vote 0 down vote accepted

After searching for hours, then posting this question, and searching for a few minutes more, I found the answer at http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/b3e6712e-cbc1-44c3-916c-6d9855f3070f

Basically here is what I did and it works:

if(SPRegionalSettings.IsRightToLeftLocale(System.Threading.Thread.CurrentThread.CurrentUICulture.LCID))

Works perfectly.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.