From d55e3b044987f29f03de2816e2cd8015c54c9db3 Mon Sep 17 00:00:00 2001 From: guochuyicmri Date: Wed, 8 May 2019 10:55:37 +0800 Subject: UUI interface Multi-language development Change-Id: I687222a6342e57bb81651ac210a8862f1980b051 Issue-ID: USECASEUI-211 Signed-off-by: guochuyicmri --- usecaseui-portal/src/app/app.component.html | 36 +++++++++++++++++++------- usecaseui-portal/src/app/app.component.ts | 40 +++++++++++++++++++++++------ usecaseui-portal/src/app/homes.service.ts | 6 +++++ 3 files changed, 65 insertions(+), 17 deletions(-) (limited to 'usecaseui-portal/src/app') diff --git a/usecaseui-portal/src/app/app.component.html b/usecaseui-portal/src/app/app.component.html index 25d8f6d6..22c22dc7 100644 --- a/usecaseui-portal/src/app/app.component.html +++ b/usecaseui-portal/src/app/app.component.html @@ -20,16 +20,34 @@ - {{"Home" | translate}} + {{"i18nTextDefine_Home" | translate}} + + + +
+
  • + + + + {{"i18nTextDefine_Customer" | translate}} + + +
  • +
    +
  • + + + + {{"i18nTextDefine_Monitor" | translate}}

  • - {{"Services" | translate}} + {{"i18nTextDefine_Services" | translate}}

  • @@ -54,7 +72,7 @@ - {{"Network" | translate}} + {{"i18nTextDefine_NetworkTopology" | translate}} diff --git a/usecaseui-portal/src/app/app.component.ts b/usecaseui-portal/src/app/app.component.ts index 0bdf72b2..1a7c48d8 100644 --- a/usecaseui-portal/src/app/app.component.ts +++ b/usecaseui-portal/src/app/app.component.ts @@ -13,8 +13,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Component } from '@angular/core'; -import { TranslateService } from '@ngx-translate/core'; +import {Component} from '@angular/core'; +import {TranslateService} from '@ngx-translate/core'; +import {MyhttpService} from "./myhttp.service"; +import {HomesService} from "./homes.service"; @Component({ @@ -23,15 +25,37 @@ import { TranslateService } from '@ngx-translate/core'; styleUrls: ['./app.component.less'] }) export class AppComponent { - constructor(private translate:TranslateService){ - translate.addLangs(['en', 'zh']); - translate.setDefaultLang('en'); - // translate.use('en'); - } + + constructor(private translate: TranslateService,private myhttp: HomesService) { + this.currentLanguageGet(); + translate.addLangs(['en', 'zh']); + // translate.use('en'); + } Language:String[] = ["zh","en"]; - selectLanguage = "en"; + //209.05.08 Get the currentLanguage + currentloginId = null; + currentLanguage = "en"; + currentLanguageGet() { + this.currentloginId = sessionStorage.getItem("loginId") || null; + if (this.currentloginId != null) { + this.myhttp.getCurrentLanguage(this.currentloginId) + .subscribe( + (data) => { + this.currentLanguage = data.languageName.toLowerCase(); + this.translate.use(this.currentLanguage); + }, + (err) => { + console.log(err); + } + ) + }else { + this.translate.setDefaultLang('en'); + } + } + + selectLanguage = "en"; changeLanguage(item){ this.selectLanguage = item; diff --git a/usecaseui-portal/src/app/homes.service.ts b/usecaseui-portal/src/app/homes.service.ts index 254408dd..8c0ab162 100644 --- a/usecaseui-portal/src/app/homes.service.ts +++ b/usecaseui-portal/src/app/homes.service.ts @@ -31,6 +31,7 @@ export class HomesService { home_servicebarData:this.baseUrl + "", sourceNames: this.baseUrl + "/alarm/getSourceNames", listSortMasters:this.baseUrl+"/listSortMasters", + currentLanguage:this.baseUrl+"/auxapi/languageSetting/user/", } @@ -110,4 +111,9 @@ export class HomesService { getListSortMasters(){ return this.http.get(this.url.listSortMasters); } + //2019.05.08 add + getCurrentLanguage(currentloginId){ + let url=this.url.currentLanguage+currentloginId; + return this.http.get(url); + } } -- cgit 1.2.3-korg