From d5c4ee60136e38caa49796365ce9e462eaeb1b0f Mon Sep 17 00:00:00 2001 From: kobepeng Date: Thu, 20 Dec 2018 14:06:13 +0800 Subject: [PATCH] feat(trasnlate): [skip travis] translate few words --- package.json | 2 +- src/app/app.component.html | 10 ++++------ src/app/pages/home/home.page.html | 4 ++-- src/app/pages/list/calendar/calendar.page.html | 2 +- src/app/pages/list/echarts/echarts.html | 2 +- src/app/pages/list/ngrxtodo/ngrxtodo.page.html | 2 +- src/app/pages/test/test.page.html | 8 ++++---- src/app/pages/test/test.page.ts | 15 ++++++++++----- src/assets/i18n/en.json | 4 +++- src/assets/i18n/zh.json | 4 +++- 10 files changed, 30 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 62c3a2d..542258e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic4-boilerplate", - "version": "0.1.0", + "version": "0.2.0", "author": "pengkobe", "homepage": "http://github.com/pengkobe/ionic4-boilerplate", "scripts": { diff --git a/src/app/app.component.html b/src/app/app.component.html index b006c0d..0591087 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -7,30 +7,28 @@ > - 菜单 + {{ 'HOME.Menu' | translate }} - 功能点 - - 首页 + {{ 'HOME.Home' | translate }} - 列表 + {{ 'HOME.List' | translate }} - 测试 + {{ 'HOME.Test' | translate }} diff --git a/src/app/pages/home/home.page.html b/src/app/pages/home/home.page.html index 18b7d9e..6103284 100644 --- a/src/app/pages/home/home.page.html +++ b/src/app/pages/home/home.page.html @@ -7,12 +7,12 @@ -

Ionic Boilerplate

+

Ionic4 Boilerplate

create by pengkobe .

{{ 'HOME.Toggle' | translate }} 点击获取随机数 + [trackParams]="{ evtName:'GetRandomNumber',parames: {cahceData:cacheData}}"> {{ 'HOME.GetRandomNumber' | translate }} {{ cacheData }}
\ No newline at end of file diff --git a/src/app/pages/list/calendar/calendar.page.html b/src/app/pages/list/calendar/calendar.page.html index 818af52..c7c46e5 100644 --- a/src/app/pages/list/calendar/calendar.page.html +++ b/src/app/pages/list/calendar/calendar.page.html @@ -9,7 +9,7 @@ - Calendar 演示 + {{ 'HOME.Calendar' | translate }} diff --git a/src/app/pages/list/echarts/echarts.html b/src/app/pages/list/echarts/echarts.html index 48c4168..31a3efe 100644 --- a/src/app/pages/list/echarts/echarts.html +++ b/src/app/pages/list/echarts/echarts.html @@ -9,7 +9,7 @@ - Echarts 演示 + Echarts diff --git a/src/app/pages/list/ngrxtodo/ngrxtodo.page.html b/src/app/pages/list/ngrxtodo/ngrxtodo.page.html index 062d3d6..6d2582d 100644 --- a/src/app/pages/list/ngrxtodo/ngrxtodo.page.html +++ b/src/app/pages/list/ngrxtodo/ngrxtodo.page.html @@ -2,7 +2,7 @@ - 返回 + TODO diff --git a/src/app/pages/test/test.page.html b/src/app/pages/test/test.page.html index 602ceeb..db7d961 100644 --- a/src/app/pages/test/test.page.html +++ b/src/app/pages/test/test.page.html @@ -35,7 +35,7 @@ - + {{ 'HOME.SwitchLanguage' | translate }} {{ 'HOME.LanguageCH' | translate }}中文 - {{ 'HOME.LanguageEN' | translate }} + English @@ -55,7 +55,7 @@ - + {{ 'HOME.Theme' | translate }} this.selectedTheme = val); } ionViewDidLoad() { console.log('ionViewDidLoad TestPage'); + this.translate.get(this.globalservice.languageType).subscribe((res: string) => { + this.languageType = res ? res : 'zh'; + }); - this.languageType = this.globalservice.languageType - ? this.globalservice.languageType - : 'zh'; if (window.cordova) { window.cordova.getAppVersion.getVersionNumber().then(version => { @@ -81,6 +83,7 @@ export class TestPage { } } + async open(format: boolean = false) { const modal = await this.modalCtrl.create({ component: QRScannerModal, @@ -131,8 +134,10 @@ export class TestPage { setLanguageType(val) { this.globalservice.languageType = val; + this.translate.get(val).subscribe((res: string) => { + this.languageType = res ? res : 'zh'; + }); this.emit.eventEmit.emit('languageType'); - this.appCenterAnalytics.setEnabled(true).then(() => { this.appCenterAnalytics.trackEvent('setLanguageType', { languageType: val }).then(() => { console.log('setLanguageType event tracked'); diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 9a8d019..073b019 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -13,6 +13,8 @@ "LanguageEN":"English", "Theme":"Theme", "Cancel":"Cancel", - "confirm":"OK" + "confirm":"OK", + "GetRandomNumber":"Get Random Number", + "Calendar":"Calendar" } } diff --git a/src/assets/i18n/zh.json b/src/assets/i18n/zh.json index 57f04e7..4c9d71d 100644 --- a/src/assets/i18n/zh.json +++ b/src/assets/i18n/zh.json @@ -13,6 +13,8 @@ "LanguageEN":"英文", "Theme":"皮肤切换", "Cancel":"取消", - "confirm":"确定" + "confirm":"确定", + "GetRandomNumber":"点击获取随机数", + "Calendar":"日历" } }