locked
Localizing a LightSwitch Application: Set Language RRS feed

  • Question

  • Hi all,

    Is it possible to set the language in code behind?

    Because the only thing I find on msdn is this:

    For a Silverlight client that’s localized into multiple languages, the active Windows language pack determines which language will appear.

    Thank you!

    Monday, March 11, 2013 4:54 PM

Answers

  • Hi all,

    Is it possible to set the language in code behind?

    Because the only thing I find on msdn is this:

    For a Silverlight client that’s localized into multiple languages, the active Windows language pack determines which language will appear.

    Thank you!

    Easy, just set the Thread.CurrentThread.CurrentUICulture to whatever you want.

    I have already implemented the instant language switch in the main screen. Doesn't even need a re-login.



    Tuesday, March 12, 2013 2:07 PM

All replies

  • Interesting question especially often in business apps, it's the context of the user in the app that should determine the language. 

    In Europe, in enterprise often English is often the OS language, but in the context of an app the user can select a different a language.

    Another scenario is apps which are used at various counters (e.g. in a bank), where depending on the person in front of the app user, the language is changed to the language of the customer so that they walk through the screens together.

    So, dynamically changing the language is definitely an important feature.


    paul van bladel

    Monday, March 11, 2013 5:16 PM
  • Don't think this is possible right now, but we could create a Connect request :-)

    It's your story - time to switch on the innovation. || About me || LightSwitch blog

    Tuesday, March 12, 2013 7:03 AM
  • Bah... :(
    Tuesday, March 12, 2013 1:20 PM
  • Hi all,

    Is it possible to set the language in code behind?

    Because the only thing I find on msdn is this:

    For a Silverlight client that’s localized into multiple languages, the active Windows language pack determines which language will appear.

    Thank you!

    Easy, just set the Thread.CurrentThread.CurrentUICulture to whatever you want.

    I have already implemented the instant language switch in the main screen. Doesn't even need a re-login.



    Tuesday, March 12, 2013 2:07 PM
  • Great info. Thanks for sharing !

    paul.


    paul van bladel

    Tuesday, March 12, 2013 2:25 PM
  • Do be carefull as it is thread specific you can end up with some odd behaviour. There are many examples for Silverlight localization on the internet. The safest is switching in code before the root content loads, often as a parameter.

    Switching dynamically there are differences between language, locale and culture. Number and date formatting can be affected amongst other things.

    That having been said, you can get t to work in a Silverlight app, but as this is LightSwitch, we do not have full control in code and Xaml.


    Dave Baker | Xpert360 blog | twitter : @xpert360 Opinions are my own. Please mark as answer if this helps solve your problem.

    Tuesday, March 12, 2013 4:21 PM
  • Thanks guys! Will test it this weekend.
    Tuesday, March 12, 2013 8:48 PM
  • Could you give an example, its no working for me
    Friday, March 6, 2020 5:35 AM
  • Hi all,

    Is it possible to set the language in code behind?

    Because the only thing I find on msdn is this:

    For a Silverlight client that’s localized into multiple languages, the active Windows language pack determines which language will appear.

    Thank you!

    Easy, just set the Thread.CurrentThread.CurrentUICulture to whatever you want.

    I have already implemented the instant language switch in the main screen. Doesn't even need a re-login.



    Could you give an example, its no working for me

    Friday, March 6, 2020 6:04 AM