It is a common practice to switch language selection, Here we can implement it by registering code in session. For example we have create three definition default, lang1 and lang2. Now we can register like below :
// Active language 1
App::Module("Language")->register('lang1');
Following function retrieve current language code.
// Get language code
App::Module("Language")->getcode();
// Get default language code
App::Module("Language")->getDefaultcode();
Following function set default language code:
// Set language code
App::Module("Language")->setDefault('lang2');