Switching Language at Runtime in LightSwitch HTML Client


d-fens GmbH

Introduction

Hi, back again and as I promised in my last post, I will show you, how we can change the language in our localized LightSwitch HTML 2013 application.
HINT: This article describes a “hack” and if anybody have a better idea-let’s talk about it! 🙂

Prerequisites

You have to be familiar with localizing a LightSwitch HTML 2013 application.
If not, take a look here: Walkthrough: Localizing a LightSwitch Application.

Some Code

First, create a new JS file in the scripts folder and reference it in the default.hm.
Add following lines to the new file: (I got this code from Javascript Madness: Query String Parsing from Jan Wolter. Great stuff, Jan. THX!)

Then, replace in default.htm

with

This is because we have to change something in ootb LS javascript. At line 1781 you will find the snippet, where LightSwitch set the default language of the application:

Change these…

View original post 248 more words