You must embed dynamic language switching in default behaviour of your application that you provide before the end user decides to switch the language.
The easiest way to embed dynamic language switching is simply to specify a one-size-fits-all default language. This is not usually attractive if you have multiple language communities. If your web application presents itself in English by default, Spanish speakers must manually switch to their language at the beginning of each new session.
Instead, a better solution is to preset a default language based on the type of caller. There are multiple possibilities here, for example:
•If you want each individual user to have her own favourite language, you must store this preference as persistent, modelled data in an application table with User Preferences. This allows you to feed the individual preference to a $.udb.ui.setLanguage() call when the user accesses the application.