Skip to content

Commit

Permalink
dev: fixes for plugin and menu localisation
Browse files Browse the repository at this point in the history
  • Loading branch information
mennodekker committed Apr 1, 2013
1 parent 694e176 commit 308a039
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
4 changes: 3 additions & 1 deletion application/core/LSUserIdentity.php
Expand Up @@ -148,7 +148,9 @@ protected function postLogin()
}

Yii::app()->session['adminlang'] = $sLanguage;
App()->getController()->lang= new limesurvey_lang($sLanguage);
$lang = new limesurvey_lang($sLanguage);
App()->lang = $lang;
App()->getController()->lang= $lang;
}

public function setPlugin($name) {
Expand Down
9 changes: 9 additions & 0 deletions application/core/LSWebUser.php
Expand Up @@ -10,6 +10,15 @@ public function __construct()
{
$this->loginUrl = Yii::app()->createUrl('admin/authentication', array('sa' => 'login'));

// Try to fix missing language in plugin controller
Yii::import('application.libraries.Limesurvey_lang');
if (empty(Yii::app()->session['adminlang']))
{
Yii::app()->session["adminlang"] = Yii::app()->getConfig("defaultlang");
}

$lang = new Limesurvey_lang(Yii::app()->session['adminlang']);
Yii::app()->setLang($lang);
}

public function checkAccess($operation, $params = array(), $allowCaching = true)
Expand Down
3 changes: 2 additions & 1 deletion application/extensions/Menu/MenuWidget.php
Expand Up @@ -51,6 +51,7 @@ protected function menuMain()
$menu['imageUrl'] = App()->getConfig('adminimageurl');
$menu['items']['left'][] = array(
'href' => array('admin/survey'),
'alt' => gT('Default administration page'),
'image' => 'home.png',
);
$menu['items']['left'][] = 'separator';
Expand Down Expand Up @@ -489,7 +490,7 @@ protected function globalSettings()
return array(
'href' => array('admin/globalsettings'),
'image' => 'global.png',
'alt' => gT('Global Settings')
'alt' => gT('Global settings')
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions application/views/plugins/configure.php
Expand Up @@ -9,7 +9,7 @@
<?php
if (isset($plugin['name']))
{
echo CHtml::tag('h1', array(), "Settings for plugin {$plugin['name']}");
echo CHtml::tag('h1', array(), sprintf(gT("Settings for plugin %s"), $plugin['name']));
}

Yii::import("application.helpers.PluginSettingsHelper");
Expand All @@ -23,8 +23,8 @@

}
echo CHtml::closeTag('ol');
echo CHtml::submitButton('Save plugin settings', array('name'=>'ok'));
echo CHtml::submitButton('Cancel', array('name'=>'cancel'));
echo CHtml::submitButton(gT('Save plugin settings'), array('name'=>'ok'));
echo CHtml::submitButton(gT('Cancel'), array('name'=>'cancel'));
echo CHtml::endForm();

?>
Expand Down
12 changes: 6 additions & 6 deletions application/views/plugins/index.php
Expand Up @@ -8,25 +8,25 @@
$gridColumns = array(
array(// display the activation link
'class' => 'CLinkColumn',
'header' => 'Status',
'labelExpression' => function($data) { return ($data['active'] == 1 ? CHtml::image(App()->getConfig('adminimageurl') . 'active.png', 'Activated', array('width' => 32, 'height' => 32)) : CHtml::image(App()->getConfig('adminimageurl') . 'inactive.png', 'Deactivated', array('width' => 32, 'height' => 32))); },
'header' => gT('Status'),
'labelExpression' => function($data) { return ($data['active'] == 1 ? CHtml::image(App()->getConfig('adminimageurl') . 'active.png', gT('Activated'), array('width' => 32, 'height' => 32)) : CHtml::image(App()->getConfig('adminimageurl') . 'inactive.png', gT('Deactivated'), array('width' => 32, 'height' => 32))); },
'url' => '#'
),
array(// display the activation link
'class' => 'CLinkColumn',
'header' => 'Action',
'labelExpression' => function($data) { return ($data['active'] == 0 ? CHtml::image(App()->getConfig('adminimageurl') . 'active.png', 'Activate', array('width' => 16, 'height' => 16)) : CHtml::image(App()->getConfig('adminimageurl') . 'inactive.png', 'Deactivate', array('width' => 16, 'height' => 16))); },
'header' => gT('Action'),
'labelExpression' => function($data) { return ($data['active'] == 0 ? CHtml::image(App()->getConfig('adminimageurl') . 'active.png', gT('Activate'), array('width' => 16, 'height' => 16)) : CHtml::image(App()->getConfig('adminimageurl') . 'inactive.png', gT('Deactivate'), array('width' => 16, 'height' => 16))); },
'urlExpression' => function($data) { return $data['active'] == 0 ? array("/plugins/activate", "id" => $data['id']) : array("/plugins/activate", "id" => $data['id']); }
),
array(// display the 'name' attribute
'class' => 'CLinkColumn',
'header' => 'Plugin',
'header' => gT('Plugin'),
'labelExpression' => function($data) { return $data['name']; },
'urlExpression' => function($data) { return array("/plugins/configure", "id" => $data['id']); }
),
array(// display the 'name' attribute
'class' => 'CDataColumn',
'header' => 'Description',
'header' => gT('Description'),
'name' => 'description'
),
);
Expand Down

0 comments on commit 308a039

Please sign in to comment.