Skip to content

Commit

Permalink
[#117] Language change
Browse files Browse the repository at this point in the history
  • Loading branch information
javieriserte committed Aug 27, 2024
1 parent 33359a8 commit 85dc6bb
Show file tree
Hide file tree
Showing 6 changed files with 1,369 additions and 1,733 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/home/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', '$i18next', 'notificationsService', 'userService', 'inboxService', NotificationsController])
.controller('notificationsController', [ '$scope', '$rootScope', '$log', '$timeout', '$route', '$i18next', 'notificationsService', 'userService', 'inboxService', NotificationsController])
.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/configuracion', {templateUrl: '/assets/javascripts/home/views/configuracion.html'});
Expand Down
13 changes: 11 additions & 2 deletions app/assets/javascripts/home/notificationsController.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
define([], function() {
'use strict';

function NotificationsController($scope, $log, $i18next, notificationsService, userService, inboxService) {
function NotificationsController($scope, $rootScope, $log, $timeout, $route, $i18next, notificationsService, userService, inboxService) {

$scope.notiCount = 0;
$scope.stall = true;
Expand Down Expand Up @@ -68,7 +68,16 @@ function NotificationsController($scope, $log, $i18next, notificationsService, u
nextLangBack = "en";
}
$i18next.options.lng = nextLangFront;
userService.setLanguage(nextLangBack);
// userService.setLanguage(nextLangBack);
$rootScope.language = nextLangFront;
$route.reload();
$rootScope.$apply();
$timeout(function() {
$rootScope.$broadcast('languageChanged');
$rootScope.$broadcast('languageChanged');
$rootScope.$digest();
});
$scope.apply();
};

}
Expand Down
8 changes: 4 additions & 4 deletions app/assets/javascripts/home/views/notifications.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

<div class="centered-text" title="Cambio de Idioma">
<span
ng-click="changeLanguage()">
<i class="bold" ng-if="getLanguage() === 'en'" title="English">EN</i>
<i class="bold" ng-if="getLanguage() === 'fr'" title="Frances">EN</i>
<i class="bold" ng-if="getLanguage() === 'es-AR'" title="Español">ES</i>
ng-click="changeLanguage()"
>
<a href="#/home" class="bold" ng-if="getLanguage() === 'en'" title="English">EN</a>
<a href="#/home" class="bold" ng-if="getLanguage() === 'es-AR'" title="Español">ES</a>
</span>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/index.scala.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@(manifest: Html, mode: String)<!DOCTYPE html>
<html lang="en">
@*<html lang="en">*@
@manifest

<head>
Expand Down
Loading

0 comments on commit 85dc6bb

Please sign in to comment.