BUG: set current locale when fetching editable widget segment

Set the current locale before rendering the editable widget segment
(if the Translatable module is installed)
This commit is contained in:
Niklas Forsdahl 2012-08-30 11:48:55 +03:00
parent 2d58a9e351
commit 78bfae971d
1 changed files with 6 additions and 0 deletions

View File

@ -211,6 +211,12 @@ class Widget_Controller extends Controller {
*/
function editablesegment() {
$className = $this->urlParams['ID'];
if (class_exists('Translatable') && Member::currentUserID()) {
// set current locale based on logged in user's locale
$locale = Member::currentUser()->Locale;
Translatable::set_current_locale($locale);
i18n::set_locale($locale);
}
if(class_exists($className) && is_subclass_of($className, 'Widget')) {
$obj = new $className();
return $obj->EditableSegment();