Skip to content

Commit

Permalink
Dev: select language by url param
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jul 21, 2017
1 parent 081d467 commit f718b88
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions application/core/LSYii_Application.php
Expand Up @@ -213,6 +213,13 @@ public function getConfig($name, $default = false)
*/
public function setLanguage( $sLanguage )
{
// This method is also called from AdminController and LSUser
// But if a param is defined, it should always have the priority
// eg: index.php/admin/authentication/sa/login/&lang=de
if ($this->request->getParam('lang') !== null){
$sLanguage = $this->request->getParam('lang');
}

$sLanguage=preg_replace('/[^a-z0-9-]/i', '', $sLanguage);
$this->messages->catalog = $sLanguage;
App()->session['_lang'] = $sLanguage; // See: http://www.yiiframework.com/wiki/26/setting-and-maintaining-the-language-in-application-i18n/
Expand Down

3 comments on commit f718b88

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must NOT be priority : we have issue before. For public : must be survey related.

@LouisGac
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, this fix is too much strong: some of the admin modules use url params instead of post params for language changes (like in quick translation). So I will limit it to the first page for now (but we should rather check the GET/POST logic in the different parts of the admin..).

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For public : sure must be set only according to Survey languages , or with 'allowed laguage' for other page (404/survey listing).

About admin : there are expression manager survey logic file where we need 2 different language : one for survey and survey translation (Example with min value settings) and one for admin language : see here https://github.com/LimeSurvey/LimeSurvey/blob/master/application/helpers/expressions/em_core_helper.php#L75 )

Please sign in to comment.