how to Get the Current language of a Sharepoint Site - InfoPath Dev
in

InfoPath Dev

how to Get the Current language of a Sharepoint Site

Last post 11-22-2011 11:14 PM by bvallambhotla. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 11-16-2011 05:08 AM

    how to Get the Current language of a Sharepoint Site

     Hi,

    I need to get the Current language of a Sharepoint Site. The requirement is as follows :

    I had a sharepoint site with language packs installed, Iam able to switch the language for any user. But I need the current language that has been selected into an Infopath form.

    I tried using SPContext.Current.Web.Locale.TwoLetterISOLanguageName, which is always returning "en", even though I selected arabic language.

     

    Please help me out !

    Regards,

    Balakiran V

     

     

  • 11-16-2011 08:01 AM In reply to

    Re: how to Get the Current language of a Sharepoint Site

    Hi,

    you can use the .NET generic way of getting current culture:

    CultureInfo currentCulture = Thread.CurrentThread.CurrentUICulture; 
    string languageCode = currentCulture.TwoLetterISOLanguageName.ToLowerInvariant();
    if (languageCode == "en") ...

    Hope that helps.

    Regards,

    Karsten
    Filed under:
  • 11-16-2011 08:14 PM In reply to

    Re: how to Get the Current language of a Sharepoint Site

     Thanks a lot Karsten !  That really worked !

    By the way can we change the direction of the View programatically ?  because Im using arabic language, everything has to be from Right to Left.

    That will help to maintain a single view instead of multiple views !

    Regards,

    Balakiran V

  • 11-17-2011 03:23 AM In reply to

    Re: how to Get the Current language of a Sharepoint Site

    Hello Balakiran,

    no --- as far as I know there“s no way to change the direction of a view programmatically.

    Regards,

    Karsten
  • 11-18-2011 03:26 AM In reply to

    Re: how to Get the Current language of a Sharepoint Site

    Dear Karsten,

    I have some problem with dropdown list changed event. Its working fine in Infopath preview, but when it is published to Sharepoint server().

    When I opened the form in browser , the same event is not firing.

    Regards,

    Balakiran V

  • 11-18-2011 12:34 PM In reply to

    Re: how to Get the Current language of a Sharepoint Site

    Hello Balakiran,

    this behaviour is often caused by the so-called 'Postback settings'. By default this is set to 'Only when necessary for correct rendering of the form'. But in many times you have to set it to 'Always'.

    You can change the default postback behavior for the drop down control control using the Postback settings options on the Browser forms tab in the Properties window for the control. There are three options available: Never, Always, and Only when necessary for correct rendering of the form (recommended). You can reduce the number of postbacks by changing the setting to Never. If you select Never, then the control will not send data to the server on change; the data will only go to the server and formatting, calculations, etc. will only run when the form user saves or submits the form, or another control in the form causes a postback to the server. For controls you want to change, you must change the postback setting option on each control individually --- and I personally recommand 'Always' in this case.

    Regards,

    Karsten
  • 11-22-2011 11:14 PM In reply to

    Re: how to Get the Current language of a Sharepoint Site

    Dear Karsten,

    ThanQ again for your  quick reply. That again worked fine.Now I'm able to post back the change in the dropdown.

    Im very new to Infopath, so if I have any question I will post ask u (if u dont mind). Please bare with me ! 

    Regards,

    Balakiran Vallambhotla

Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.