diff --git a/code/controller/WidgetController.php b/code/controller/WidgetController.php index 1896296..1008ee5 100644 --- a/code/controller/WidgetController.php +++ b/code/controller/WidgetController.php @@ -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')) { diff --git a/javascript/WidgetAreaEditor.js b/javascript/WidgetAreaEditor.js index 840d5a2..9baf7bb 100644 --- a/javascript/WidgetAreaEditor.js +++ b/javascript/WidgetAreaEditor.js @@ -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 , + }, }); }, @@ -177,4 +182,4 @@ } }); }) -})(jQuery); \ No newline at end of file +})(jQuery);