Fixed locale for AJAX requests on addWidget.

Currently locale is ignored with AJAX add requests, this patch sends the form locale with the request.
This commit is contained in:
Sixfifty 2013-08-06 16:27:04 +01:00 committed by Dave Hill
parent 6f534f5943
commit 1013e216c2
2 changed files with 8 additions and 4 deletions

View File

@ -99,7 +99,6 @@ class WidgetController extends Controller {
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')) {

View File

@ -103,10 +103,15 @@
}
}
var parentRef=$(this);
var parentRef=$(this),
locale = $(this).closest('form').find('input[name=Locale]').val();
$.ajax({
'url': 'WidgetController/EditableSegment/' + className,
'success' : function(response) {parentRef.insertWidgetEditor(response)}
'success' : function(response) {parentRef.insertWidgetEditor(response)},
'data' : {
'locale' : locale ,
},
});
},