- constructor($log, $window, userProfileService, menusService, $scope, ECOMP_URL_REGEX, $cookies, $state,auditLogService,notificationService,ngDialog,$modal) {
- this.firstName = '';
- this.lastName = '';
- this.$log = $log;
- this.menusService = menusService;
- this.$scope = $scope;
- this.favoritesMenuItems = '';
- $scope.favoriteItemsCount = 0;
- $scope.favoritesMenuItems = '';
- $scope.showFavorites = false;
- $scope.emptyFavorites = false;
- $scope.favoritesWindow = false;
- $scope.notificationCount=0;
- $scope.showNotification = true;
+ constructor($log, $window, $translate, translateService,userProfileService, menusService, $scope, ECOMP_URL_REGEX, $cookies, $state,auditLogService,notificationService,ngDialog,$modal) {
+ this.firstName = '';
+ this.lastName = '';
+ this.$log = $log;
+ this.menusService = menusService;
+ this.$scope = $scope;
+ this.favoritesMenuItems = '';
+ $scope.cur_lang = '';
+ $scope.langList = []
+ $scope.favoriteItemsCount = 0;
+ $scope.favoritesMenuItems = '';
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = false;
+ $scope.favoritesWindow = false;
+ $scope.notificationCount=0;
+ $scope.showNotification = true;
+ // get all languages
+ var loginId = sessionStorage.getItem('userId')
+ translateService.getCurrentLang(loginId).then(res => {
+ $scope.cur_lang = res.languageAlias
+ $translate.use($scope.cur_lang);
+ })
+ translateService.getLangList().then(res => {
+ $scope.langList = res.languageList
+ })
+ // switch language
+ $scope.switching = function(lang) {
+ $translate.use(lang);
+ var langs = $scope.langList
+ var langId = ''
+ var selectedLang = langs.find(function(item) {
+ return item.languageAlias === lang;
+ });
+ langId = selectedLang.languageId
+ var loginId = sessionStorage.getItem('userId')
+ translateService.saveSelectedLang(loginId, {'languageId': langId}).then(res => {
+ window.location.reload();
+ })
+ }
+ $scope.cur_lang = $translate.use();