diff --git a/app/assets/javascripts/home/main.js b/app/assets/javascripts/home/main.js index 479dcc9..df1c6c6 100644 --- a/app/assets/javascripts/home/main.js +++ b/app/assets/javascripts/home/main.js @@ -11,7 +11,7 @@ angular .controller('errorController', ['$scope', 'errorService', 'alertService', ErrorController]) .controller('headerController', ['$scope', 'userService', '$location', '$modal', 'hotkeys','appConf', HeaderController]) .service('notificationsService', ['$log','$rootScope', 'cryptoService', 'userService', NotificationsService]) - .controller('notificationsController', [ '$scope', '$log', 'notificationsService', 'userService', 'inboxService', NotificationsController]) + .controller('notificationsController', [ '$scope', '$log', '$i18next', 'notificationsService', 'userService', 'inboxService', NotificationsController]) .config(['$routeProvider', function($routeProvider) { $routeProvider .when('/configuracion', {templateUrl: '/assets/javascripts/home/views/configuracion.html'}); diff --git a/app/assets/javascripts/home/notificationsController.js b/app/assets/javascripts/home/notificationsController.js index aadc446..ffd8f5b 100644 --- a/app/assets/javascripts/home/notificationsController.js +++ b/app/assets/javascripts/home/notificationsController.js @@ -1,7 +1,7 @@ define([], function() { 'use strict'; -function NotificationsController($scope, $log, notificationsService, userService, inboxService) { +function NotificationsController($scope, $log, $i18next, notificationsService, userService, inboxService) { $scope.notiCount = 0; $scope.stall = true; @@ -52,6 +52,21 @@ function NotificationsController($scope, $log, notificationsService, userService $scope.$apply(); }); + $scope.getLanguage = function(){ + return $i18next.options.lng; + }; + + $scope.changeLanguage = function(lang){ + var nextLang = ""; + if ($scope.getLanguage() === "en") { + nextLang = "es-AR"; + } + if ($scope.getLanguage() === "es-AR") { + nextLang = "en"; + } + $i18next.options.lng = nextLang; + }; + } return NotificationsController; diff --git a/app/assets/javascripts/home/views/notifications.html b/app/assets/javascripts/home/views/notifications.html index bff9246..1ff75c9 100644 --- a/app/assets/javascripts/home/views/notifications.html +++ b/app/assets/javascripts/home/views/notifications.html @@ -1,5 +1,14 @@