summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app
diff options
context:
space:
mode:
authorguochuyicmri <guochuyi@chinamobile.com>2019-05-08 10:55:37 +0800
committerguochuyicmri <guochuyi@chinamobile.com>2019-05-08 10:55:46 +0800
commitd55e3b044987f29f03de2816e2cd8015c54c9db3 (patch)
tree5fe2b92222483983d58b2edf892e2b60d5cbde3f /usecaseui-portal/src/app
parentbf240f4fad6e8bf032bd1f190b238682a9fb721a (diff)
UUI interface Multi-language development
Change-Id: I687222a6342e57bb81651ac210a8862f1980b051 Issue-ID: USECASEUI-211 Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src/app')
-rw-r--r--usecaseui-portal/src/app/app.component.html36
-rw-r--r--usecaseui-portal/src/app/app.component.ts40
-rw-r--r--usecaseui-portal/src/app/homes.service.ts6
3 files changed, 65 insertions, 17 deletions
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 @@
<a routerLink="home">
<span title>
<i class="anticon anticon-home"></i>
- <span> {{"Home" | translate}} </span>
+ <span> {{"i18nTextDefine_Home" | translate}} </span>
+ </span>
+ </a>
+ </li>
+ <hr>
+ <li nz-menu-item>
+ <a routerLink="management">
+ <span title>
+ <i class="anticon anticon-user"></i>
+ <span> {{"i18nTextDefine_Customer" | translate}} </span>
+ </span>
+ </a>
+ </li>
+ <hr>
+ <li nz-menu-item>
+ <a routerLink="fcaps">
+ <span title>
+ <i class="anticon anticon-user"></i>
+ <span> {{"i18nTextDefine_Monitor" | translate}} </span>
</span>
</a>
</li>
<hr>
<li nz-submenu>
- <span title><i class="anticon anticon-home"></i> {{"Services" | translate}} </span>
+ <span title><i class="anticon anticon-home"></i> {{"i18nTextDefine_Services" | translate}} </span>
<ul>
- <li nz-menu-item><a routerLink='services/services-list'> {{"Services List" | translate}}</a></li>
- <li nz-menu-item><a routerLink='services/onboard-vnf-vm'> Onboard VNF/VM </a></li>
+ <li nz-menu-item><a routerLink='services/services-list'> {{"i18nTextDefine_ServicesList" | translate}} </a></li>
+ <li nz-menu-item><a routerLink='services/onboard-vnf-vm'> {{"i18nTextDefine_Onboard_VNF/VM" | translate}} </a></li>
</ul>
</li>
<!-- <hr>
@@ -37,16 +55,16 @@
<a routerLink="alarm">
<span title>
<i class="anticon anticon-mail"></i>
- <span> {{"Alarm" | translate}} </span>
+ <span> {{"i18nTextDefine_Alarm" | translate}} </span>
</span>
</a>
</li>
<hr> -->
<!-- <li nz-submenu>
- <span title><i class="anticon anticon-setting"></i> {{"Monitor" | translate}} </span>
+ <span title><i class="anticon anticon-setting"></i> {{"i18nTextDefine_Monitor" | translate}} </span>
<ul>
- <li nz-menu-item><a routerLink='alarm'> {{"Alarm" | translate}} </a></li>
- <li nz-menu-item><a routerLink='performance/performance-vnf'> {{"Performance" | translate}}</a></li>
+ <li nz-menu-item><a routerLink='alarm'> {{"i18nTextDefine_Alarm" | translate}} </a></li>
+ <li nz-menu-item><a routerLink='performance/performance-vnf'> {{"i18nTextDefine_Performance" | translate}}</a></li>
</ul>
</li> -->
<hr>
@@ -54,7 +72,7 @@
<a routerLink="network">
<span title>
<i class="anticon anticon-share-alt"></i>
- <span> {{"Network" | translate}} </span>
+ <span> {{"i18nTextDefine_NetworkTopology" | translate}} </span>
</span>
</a>
</li>
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<any>(this.url.listSortMasters);
}
+ //2019.05.08 add
+ getCurrentLanguage(currentloginId){
+ let url=this.url.currentLanguage+currentloginId;
+ return this.http.get<any>(url);
+ }
}