1

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?

1
  • 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! Commented Jun 15, 2012 at 17:19

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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