none
get current selected langauage in sharepoint foundation 2010

    Question

  • Hi every one,

           

            My need to get current selected language in SharePoint Foundation 2010 site.

     I use web.SupportedUICultures but it is return all language,  But my need is current selected language.

    How I get this.

           

    Wednesday, September 01, 2010 2:01 PM

Answers

  • Hi

     i found solution  Use

    System.Threading.Thread.CurrentThread.CurrentUICulture.LCID.ToString();

    for find current selected language.

     

    • Marked as answer by Navaratan Thursday, September 02, 2010 4:59 AM
    Thursday, September 02, 2010 4:59 AM

All replies

  • Hello Navaratan,

    There is a property SPWeb.Language, it's straightforward and can give you the default language of the web, check out the sample code on the MSDN documentation: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.language.aspx


    Mohamed Saleh [SharePoint Server MVP]
    Wednesday, September 01, 2010 2:07 PM
  • Hi

     MSaleh

                  Thanks for reply.

                           But my need is which alternate languages  is currently selected by login User.

    Wednesday, September 01, 2010 2:10 PM
  • Hello Again,

    I don't have additional language pack on my dev enviroment right now, but can you try out SPContext.Current.Web.Language , i believe it's retrieve the current select language, and please share with us the result.


    Mohamed Saleh [SharePoint Server MVP]
    Wednesday, September 01, 2010 2:45 PM
  • Hi MSaleh

              thanks, it also return default language .

    Thursday, September 02, 2010 4:41 AM
  • Hi

     i found solution  Use

    System.Threading.Thread.CurrentThread.CurrentUICulture.LCID.ToString();

    for find current selected language.

     

    • Marked as answer by Navaratan Thursday, September 02, 2010 4:59 AM
    Thursday, September 02, 2010 4:59 AM
  • You can also use javascript to find current UI language.....

     

    var lcid =_spPageContextInfo.currentLanguage;

     

    this will give you LCID same as System.Threading.Thread.CurrentThread.CurrentUICulture.LCID.ToString();


    -Denny Dev
    • Proposed as answer by Amar Trivedi Saturday, April 09, 2011 6:15 AM
    Saturday, April 09, 2011 6:14 AM
  • does anybody know how to get the current culture (from 1033 --> en-US). I tried several examples but it returns always the LCID

    Monday, December 03, 2012 4:10 PM
  • @Mehmet: i think you allready have the solution, but for everyone else:

    you can use:

    System.Threading.Thread.CurrentThread.CurrentUICulture.Name to get "en-US"

    Monday, March 18, 2013 4:52 PM