├── src ├── pages │ ├── home │ │ ├── home.scss │ │ ├── home.html │ │ └── home.ts │ ├── about │ │ ├── about.scss │ │ ├── about.ts │ │ └── about.html │ ├── contact │ │ ├── contact.scss │ │ ├── contact.ts │ │ └── contact.html │ └── tabs │ │ ├── tabs.html │ │ └── tabs.ts ├── app │ ├── app.html │ ├── main.ts │ ├── app.scss │ ├── app.component.ts │ └── app.module.ts ├── models │ └── language.model.ts ├── assets │ ├── icon │ │ └── favicon.ico │ └── i18n │ │ ├── ar.json │ │ ├── en.json │ │ └── es.json ├── manifest.json ├── providers │ └── language.service.ts ├── declarations.d.ts ├── index.html ├── theme │ └── variables.scss └── service-worker.js ├── resources ├── icon.png.md5 ├── splash.png.md5 ├── icon.png ├── splash.png ├── ios │ ├── icon │ │ ├── icon.png │ │ ├── icon-40.png │ │ ├── icon-50.png │ │ ├── icon-60.png │ │ ├── icon-72.png │ │ ├── icon-76.png │ │ ├── icon@2x.png │ │ ├── icon-40@2x.png │ │ ├── icon-40@3x.png │ │ ├── icon-50@2x.png │ │ ├── icon-60@2x.png │ │ ├── icon-60@3x.png │ │ ├── icon-72@2x.png │ │ ├── icon-76@2x.png │ │ ├── icon-small.png │ │ ├── icon-83.5@2x.png │ │ ├── icon-small@2x.png │ │ └── icon-small@3x.png │ └── splash │ │ ├── Default-667h.png │ │ ├── Default-736h.png │ │ ├── Default~iphone.png │ │ ├── Default@2x~iphone.png │ │ ├── Default-Portrait~ipad.png │ │ ├── Default-568h@2x~iphone.png │ │ ├── Default-Landscape-736h.png │ │ ├── Default-Landscape~ipad.png │ │ ├── Default-Portrait@2x~ipad.png │ │ ├── Default-Landscape@2x~ipad.png │ │ ├── Default-Landscape@~ipadpro.png │ │ └── Default-Portrait@~ipadpro.png └── android │ ├── icon │ ├── drawable-hdpi-icon.png │ ├── drawable-ldpi-icon.png │ ├── drawable-mdpi-icon.png │ ├── drawable-xhdpi-icon.png │ ├── drawable-xxhdpi-icon.png │ └── drawable-xxxhdpi-icon.png │ └── splash │ ├── drawable-land-hdpi-screen.png │ ├── drawable-land-ldpi-screen.png │ ├── drawable-land-mdpi-screen.png │ ├── drawable-port-hdpi-screen.png │ ├── drawable-port-ldpi-screen.png │ ├── drawable-port-mdpi-screen.png │ ├── drawable-land-xhdpi-screen.png │ ├── drawable-land-xxhdpi-screen.png │ ├── drawable-port-xhdpi-screen.png │ ├── drawable-port-xxhdpi-screen.png │ ├── drawable-land-xxxhdpi-screen.png │ └── drawable-port-xxxhdpi-screen.png ├── ionic.config.json ├── tslint.json ├── .editorconfig ├── tsconfig.json ├── .gitignore ├── README.md ├── package.json └── config.xml /src/pages/home/home.scss: -------------------------------------------------------------------------------- 1 | page-home { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /resources/icon.png.md5: -------------------------------------------------------------------------------- 1 | 3f1bbdf1aefcb5ce7b60770ce907c68f -------------------------------------------------------------------------------- /resources/splash.png.md5: -------------------------------------------------------------------------------- 1 | 0dcf1df8c92c1ece4382d3357d9f8562 -------------------------------------------------------------------------------- /src/pages/about/about.scss: -------------------------------------------------------------------------------- 1 | page-about { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/contact/contact.scss: -------------------------------------------------------------------------------- 1 | page-contact { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/app/app.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/models/language.model.ts: -------------------------------------------------------------------------------- 1 | export class LanguageModel{ 2 | name: string; 3 | code: string; 4 | } 5 | -------------------------------------------------------------------------------- /resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/icon.png -------------------------------------------------------------------------------- /resources/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/splash.png -------------------------------------------------------------------------------- /resources/ios/icon/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon.png -------------------------------------------------------------------------------- /src/assets/icon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/src/assets/icon/favicon.ico -------------------------------------------------------------------------------- /resources/ios/icon/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-40.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-50.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-60.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-72.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-76.png -------------------------------------------------------------------------------- /resources/ios/icon/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-40@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-40@3x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-50@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-60@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-60@3x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-72@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-76@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-small.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-83.5@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-small@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/icon/icon-small@3x.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-667h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/splash/Default-667h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/splash/Default-736h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/splash/Default~iphone.png -------------------------------------------------------------------------------- /resources/ios/splash/Default@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/splash/Default@2x~iphone.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-hdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/icon/drawable-hdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-ldpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/icon/drawable-ldpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-mdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/icon/drawable-mdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-xhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/icon/drawable-xhdpi-icon.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/splash/Default-Portrait~ipad.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-xxhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/icon/drawable-xxhdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-xxxhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/icon/drawable-xxxhdpi-icon.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-568h@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/splash/Default-568h@2x~iphone.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/splash/Default-Landscape-736h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/splash/Default-Landscape~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/splash/Default-Portrait@2x~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/splash/Default-Landscape@2x~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/splash/Default-Landscape@~ipadpro.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/ios/splash/Default-Portrait@~ipadpro.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/splash/drawable-land-hdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/splash/drawable-land-ldpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/splash/drawable-land-mdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/splash/drawable-port-hdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/splash/drawable-port-ldpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/splash/drawable-port-mdpi-screen.png -------------------------------------------------------------------------------- /ionic.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "internationalize-and-localize-your-ionic2-app", 3 | "app_id": "", 4 | "type": "ionic-angular", 5 | "integrations": { 6 | "cordova": {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/splash/drawable-land-xhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/splash/drawable-land-xxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/splash/drawable-port-xhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/splash/drawable-port-xxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/splash/drawable-land-xxxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/building-an-ionic3-multi-language-app/HEAD/resources/android/splash/drawable-port-xxxhdpi-screen.png -------------------------------------------------------------------------------- /src/app/main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | 3 | import { AppModule } from './app.module'; 4 | 5 | platformBrowserDynamic().bootstrapModule(AppModule); 6 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-duplicate-variable": true, 4 | "no-unused-variable": [ 5 | true 6 | ] 7 | }, 8 | "rulesDirectory": [ 9 | "node_modules/tslint-eslint-rules/dist/rules" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /src/assets/i18n/ar.json: -------------------------------------------------------------------------------- 1 | { 2 | "HOME": "استهلال", 3 | "ABOUT": "حول", 4 | "CONTACT": "اتصال", 5 | "HI" : "مرحبا {{name}}", 6 | "AGE" : "عمرك: {{age}}", 7 | "SELECT_LANGUAGE": "اختر لغتك", 8 | "LANGUAGES": "اللغات", 9 | "CANCEL": "إلغاء", 10 | "FOLLOW_US_TW": "تابعونا على تويتر" 11 | } 12 | -------------------------------------------------------------------------------- /src/assets/i18n/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "HOME": "Home", 3 | "ABOUT": "About", 4 | "CONTACT": "Contact", 5 | "HI" : "Hi {{name}}", 6 | "AGE" : "Your age is: {{age}}", 7 | "SELECT_LANGUAGE": "Select your language", 8 | "LANGUAGES": "Languages", 9 | "CANCEL": "Cancel", 10 | "FOLLOW_US_TW": "Follow us on Twitter" 11 | } 12 | -------------------------------------------------------------------------------- /src/assets/i18n/es.json: -------------------------------------------------------------------------------- 1 | { 2 | "HOME": "Inicio", 3 | "ABOUT": "Acerca", 4 | "CONTACT": "Contacto", 5 | "HI" : "Hola {{name}}", 6 | "AGE" : "Tu edad es: {{age}}", 7 | "SELECT_LANGUAGE": "Selecciona tu idioma", 8 | "LANGUAGES": "Idiomas", 9 | "CANCEL": "Cancelar", 10 | "FOLLOW_US_TW": "Seguinos en Twitter" 11 | } 12 | -------------------------------------------------------------------------------- /src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ionic", 3 | "short_name": "Ionic", 4 | "start_url": "index.html", 5 | "display": "standalone", 6 | "icons": [{ 7 | "src": "assets/imgs/logo.png", 8 | "sizes": "512x512", 9 | "type": "image/png" 10 | }], 11 | "background_color": "#4e8ef7", 12 | "theme_color": "#4e8ef7" 13 | } -------------------------------------------------------------------------------- /src/pages/contact/contact.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | import { NavController } from 'ionic-angular'; 4 | 5 | @Component({ 6 | selector: 'page-contact', 7 | templateUrl: 'contact.html' 8 | }) 9 | export class ContactPage { 10 | 11 | constructor(public navCtrl: NavController) { 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/pages/tabs/tabs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/pages/about/about.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | import { NavController } from 'ionic-angular'; 4 | 5 | @Component({ 6 | selector: 'page-about', 7 | templateUrl: 'about.html' 8 | }) 9 | export class AboutPage { 10 | param = { 11 | name: 'John Doe', 12 | age: '25' 13 | }; 14 | 15 | constructor(public navCtrl: NavController) { 16 | 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | indent_style = space 8 | indent_size = 2 9 | 10 | # We recommend you to keep these unchanged 11 | end_of_line = lf 12 | charset = utf-8 13 | trim_trailing_whitespace = true 14 | insert_final_newline = true 15 | 16 | [*.md] 17 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /src/pages/contact/contact.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ 'CONTACT' | translate }} 4 | 5 | 6 | 7 | 8 | 9 | {{ 'FOLLOW_US_TW' | translate }} 10 | 11 | 12 | @ionicthemes 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/pages/tabs/tabs.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | import { HomePage } from '../home/home'; 4 | import { AboutPage } from '../about/about'; 5 | import { ContactPage } from '../contact/contact'; 6 | 7 | @Component({ 8 | templateUrl: 'tabs.html' 9 | }) 10 | export class TabsPage { 11 | // this tells the tabs component which Pages 12 | // should be each tab's root Page 13 | tab1Root: any = HomePage; 14 | tab2Root: any = AboutPage; 15 | tab3Root: any = ContactPage; 16 | 17 | constructor() { 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/providers/language.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from "@angular/core"; 2 | import { LanguageModel } from "../models/language.model"; 3 | 4 | @Injectable() 5 | export class LanguageService { 6 | languages : Array = new Array(); 7 | 8 | constructor() { 9 | this.languages.push( 10 | {name: "English", code: "en"}, 11 | {name: "Spanish", code: "es"}, 12 | {name: "Arabic", code: "ar"} 13 | ); 14 | } 15 | 16 | getLanguages(){ 17 | return this.languages; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/pages/about/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ 'ABOUT' | translate }} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | {{'HI' | translate:param}} 13 | 14 |

15 | {{'AGE' | translate:param}} 16 |

17 |
18 |
19 |
20 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowSyntheticDefaultImports": true, 4 | "declaration": false, 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "lib": [ 8 | "dom", 9 | "es2015" 10 | ], 11 | "module": "es2015", 12 | "moduleResolution": "node", 13 | "sourceMap": true, 14 | "target": "es5" 15 | }, 16 | "include": [ 17 | "src/**/*.ts" 18 | ], 19 | "exclude": [ 20 | "node_modules" 21 | ], 22 | "compileOnSave": false, 23 | "atom": { 24 | "rewriteTsconfig": false 25 | } 26 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Specifies intentionally untracked files to ignore when using Git 2 | # http://git-scm.com/docs/gitignore 3 | 4 | *~ 5 | *.sw[mnpcod] 6 | *.log 7 | *.tmp 8 | *.tmp.* 9 | log.txt 10 | *.sublime-project 11 | *.sublime-workspace 12 | .vscode/ 13 | npm-debug.log* 14 | 15 | .idea/ 16 | .sass-cache/ 17 | .tmp/ 18 | .versions/ 19 | coverage/ 20 | dist/ 21 | node_modules/ 22 | tmp/ 23 | temp/ 24 | hooks/ 25 | platforms/ 26 | plugins/ 27 | plugins/android.json 28 | plugins/ios.json 29 | www/ 30 | $RECYCLE.BIN/ 31 | 32 | .DS_Store 33 | Thumbs.db 34 | UserInterfaceState.xcuserstate 35 | 36 | www.zip 37 | -------------------------------------------------------------------------------- /src/pages/home/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ 'HOME' | translate }} 4 | 5 | 6 | 7 | 8 | 9 | 10 | {{ 'SELECT_LANGUAGE' | translate }} 11 | 12 | {{item.name}} 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/declarations.d.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Declaration files are how the Typescript compiler knows about the type information(or shape) of an object. 3 | They're what make intellisense work and make Typescript know all about your code. 4 | 5 | A wildcard module is declared below to allow third party libraries to be used in an app even if they don't 6 | provide their own type declarations. 7 | 8 | To learn more about using third party libraries in an Ionic app, check out the docs here: 9 | http://ionicframework.com/docs/v2/resources/third-party-libs/ 10 | 11 | For more info on type definition files, check out the Typescript docs here: 12 | https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html 13 | */ 14 | declare module '*'; -------------------------------------------------------------------------------- /src/app/app.scss: -------------------------------------------------------------------------------- 1 | // http://ionicframework.com/docs/v2/theming/ 2 | 3 | 4 | // App Global Sass 5 | // -------------------------------------------------- 6 | // Put style rules here that you want to apply globally. These 7 | // styles are for the entire app and not just one component. 8 | // Additionally, this file can be also used as an entry point 9 | // to import other Sass files to be included in the output CSS. 10 | // 11 | // Shared Sass variables, which can be used to adjust Ionic's 12 | // default Sass variables, belong in "theme/variables.scss". 13 | // 14 | // To declare rules for a specific mode, create a child rule 15 | // for the .md, .ios, or .wp mode classes. The mode class is 16 | // automatically applied to the element in the app. 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Complete Tutorial in: https://ionicthemes.com/tutorials/about/internationalize-and-localize-your-ionic2-app-with-ngtranslate 2 | 3 | In this post we will show you how to internationalize and localize your Ionic 3 app in order to support different languages. 4 | 5 | We are going to build a basic app which supports three languages. We will also go the extra mile and build the app to support RTL. 6 | 7 | ![](https://s3-us-west-2.amazonaws.com/ionicthemes/tutorials/screenshots/internationalize-and-localize-your-ionic2-app-with-ngtranslate/1.png) 8 | ![](https://s3-us-west-2.amazonaws.com/ionicthemes/tutorials/screenshots/internationalize-and-localize-your-ionic2-app-with-ngtranslate/2.png) 9 | ![](https://s3-us-west-2.amazonaws.com/ionicthemes/tutorials/screenshots/internationalize-and-localize-your-ionic2-app-with-ngtranslate/3.png) 10 | -------------------------------------------------------------------------------- /src/pages/home/home.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NavController } from 'ionic-angular'; 3 | import { TranslateService } from '@ngx-translate/core'; 4 | import { LanguageService } from "../../providers/language.service"; 5 | import { LanguageModel } from "../../models/language.model"; 6 | 7 | @Component({ 8 | selector: 'page-home', 9 | templateUrl: 'home.html' 10 | }) 11 | export class HomePage { 12 | languageSelected : any = 'en'; 13 | languages : Array; 14 | 15 | constructor( 16 | public navCtrl: NavController, 17 | public translate: TranslateService, 18 | public languageService: LanguageService 19 | ) 20 | { 21 | this.languages = this.languageService.getLanguages(); 22 | this.setLanguage(); 23 | } 24 | 25 | setLanguage(){ 26 | let defaultLanguage = this.translate.getDefaultLang(); 27 | if(this.languageSelected){ 28 | this.translate.setDefaultLang(this.languageSelected); 29 | this.translate.use(this.languageSelected); 30 | }else{ 31 | this.languageSelected = defaultLanguage; 32 | this.translate.use(defaultLanguage); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { Platform } from 'ionic-angular'; 3 | import { SplashScreen} from "@ionic-native/splash-screen"; 4 | import { StatusBar} from "@ionic-native/status-bar"; 5 | 6 | import { TabsPage } from '../pages/tabs/tabs'; 7 | 8 | import { TranslateService, LangChangeEvent } from '@ngx-translate/core'; 9 | 10 | 11 | @Component({ 12 | templateUrl: 'app.html' 13 | }) 14 | export class MyApp { 15 | rootPage = TabsPage; 16 | textDir: string = "ltr"; 17 | 18 | constructor( 19 | platform: Platform, 20 | public translate: TranslateService, 21 | public statusBar: StatusBar, 22 | public splashScreen: SplashScreen) { 23 | 24 | translate.setDefaultLang('en'); 25 | translate.use('en'); 26 | 27 | platform.ready().then(() => { 28 | // Okay, so the platform is ready and our plugins are available. 29 | // Here you can do any higher level native things you might need. 30 | this.statusBar.styleDefault(); 31 | this.splashScreen.hide(); 32 | 33 | //this is to determine the text direction depending on the selected language 34 | this.translate.onLangChange.subscribe((event: LangChangeEvent) => 35 | { 36 | this.textDir = event.lang == 'ar'? 'rtl' : 'ltr'; 37 | }); 38 | }); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ionic App 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { IonicApp, IonicModule } from 'ionic-angular'; 3 | import { MyApp } from './app.component'; 4 | import { BrowserModule } from '@angular/platform-browser'; 5 | import { AboutPage } from '../pages/about/about'; 6 | import { ContactPage } from '../pages/contact/contact'; 7 | import { HomePage } from '../pages/home/home'; 8 | import { TabsPage } from '../pages/tabs/tabs'; 9 | import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; 10 | import { TranslateHttpLoader } from '@ngx-translate/http-loader'; 11 | import { Http, HttpModule } from '@angular/http'; 12 | import { LanguageService } from '../providers/language.service'; 13 | import { SplashScreen} from "@ionic-native/splash-screen"; 14 | import { StatusBar} from "@ionic-native/status-bar"; 15 | 16 | export function createTranslateLoader(http: Http) { 17 | return new TranslateHttpLoader(http, './assets/i18n/', '.json'); 18 | } 19 | 20 | @NgModule({ 21 | declarations: [ 22 | MyApp, 23 | AboutPage, 24 | ContactPage, 25 | HomePage, 26 | TabsPage 27 | ], 28 | imports: [ 29 | BrowserModule, 30 | HttpModule, 31 | IonicModule.forRoot(MyApp), 32 | TranslateModule.forRoot({ 33 | loader: { 34 | provide: TranslateLoader, 35 | useFactory: (createTranslateLoader), 36 | deps: [Http] 37 | } 38 | }) 39 | ], 40 | bootstrap: [IonicApp], 41 | entryComponents: [ 42 | MyApp, 43 | AboutPage, 44 | ContactPage, 45 | HomePage, 46 | TabsPage 47 | ], 48 | providers: [ 49 | LanguageService, 50 | SplashScreen, 51 | StatusBar] 52 | }) 53 | export class AppModule {} 54 | -------------------------------------------------------------------------------- /src/theme/variables.scss: -------------------------------------------------------------------------------- 1 | // Ionic Variables and Theming. For more info, please see: 2 | // http://ionicframework.com/docs/v2/theming/ 3 | $font-path: "../assets/fonts"; 4 | 5 | @import "ionic.globals"; 6 | 7 | 8 | // Shared Variables 9 | // -------------------------------------------------- 10 | // To customize the look and feel of this app, you can override 11 | // the Sass variables found in Ionic's source scss files. 12 | // To view all the possible Ionic variables, see: 13 | // http://ionicframework.com/docs/v2/theming/overriding-ionic-variables/ 14 | 15 | 16 | 17 | 18 | // Named Color Variables 19 | // -------------------------------------------------- 20 | // Named colors makes it easy to reuse colors on various components. 21 | // It's highly recommended to change the default colors 22 | // to match your app's branding. Ionic uses a Sass map of 23 | // colors so you can add, rename and remove colors as needed. 24 | // The "primary" color is the only required color in the map. 25 | 26 | $colors: ( 27 | primary: #387ef5, 28 | secondary: #32db64, 29 | danger: #f53d3d, 30 | light: #f4f4f4, 31 | dark: #222 32 | ); 33 | 34 | 35 | // App iOS Variables 36 | // -------------------------------------------------- 37 | // iOS only Sass variables can go here 38 | 39 | 40 | 41 | 42 | // App Material Design Variables 43 | // -------------------------------------------------- 44 | // Material Design only Sass variables can go here 45 | 46 | 47 | 48 | 49 | // App Windows Variables 50 | // -------------------------------------------------- 51 | // Windows only Sass variables can go here 52 | 53 | 54 | 55 | 56 | // App Theme 57 | // -------------------------------------------------- 58 | // Ionic apps can have different themes applied, which can 59 | // then be future customized. This import comes last 60 | // so that the above variables are used and Ionic's 61 | // default are overridden. 62 | 63 | @import "ionic.theme.default"; 64 | 65 | 66 | // Ionicons 67 | // -------------------------------------------------- 68 | // The premium icon font for Ionic. For more info, please see: 69 | // http://ionicframework.com/docs/v2/ionicons/ 70 | 71 | @import "ionicons"; 72 | 73 | 74 | // Fonts 75 | // -------------------------------------------------- 76 | 77 | @import "roboto"; 78 | @import "noto-sans"; 79 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "internationalize-and-localize-your-ionic2-example", 3 | "author": "IonicThemes", 4 | "homepage": "http://ionicthemes.com/", 5 | "private": true, 6 | "scripts": { 7 | "clean": "ionic-app-scripts clean", 8 | "build": "ionic-app-scripts build", 9 | "ionic:build": "ionic-app-scripts build", 10 | "ionic:serve": "ionic-app-scripts serve" 11 | }, 12 | "dependencies": { 13 | "@angular/common": "4.1.0", 14 | "@angular/compiler": "4.1.0", 15 | "@angular/compiler-cli": "4.1.0", 16 | "@angular/core": "4.1.0", 17 | "@angular/forms": "4.1.0", 18 | "@angular/http": "4.1.0", 19 | "@angular/platform-browser": "4.1.0", 20 | "@angular/platform-browser-dynamic": "4.1.0", 21 | "@ionic-native/core": "3.6.1", 22 | "@ionic-native/splash-screen": "3.6.1", 23 | "@ionic-native/status-bar": "3.6.1", 24 | "@ionic/storage": "2.0.1", 25 | "@ngx-translate/core": "^6.0.1", 26 | "@ngx-translate/http-loader": "0.0.3", 27 | "cordova-ios": "^4.4.0", 28 | "ionic-angular": "3.2.1", 29 | "ionicons": "3.0.0", 30 | "rxjs": "5.1.1", 31 | "sw-toolbox": "3.6.0", 32 | "zone.js": "0.8.10", 33 | "cordova-plugin-console": "1.0.5", 34 | "cordova-plugin-device": "1.1.4", 35 | "cordova-plugin-splashscreen": "~4.0.1", 36 | "cordova-plugin-statusbar": "2.2.1", 37 | "cordova-plugin-whitelist": "1.3.1", 38 | "ionic-plugin-keyboard": "~2.2.1" 39 | }, 40 | "devDependencies": { 41 | "@ionic/app-scripts": "1.3.7", 42 | "@ionic/cli-plugin-cordova": "1.1.2", 43 | "@ionic/cli-plugin-ionic-angular": "1.1.2", 44 | "typescript": "2.2.1" 45 | }, 46 | "cordovaPlugins": [ 47 | "cordova-plugin-whitelist", 48 | "cordova-plugin-statusbar", 49 | "cordova-plugin-console", 50 | "cordova-plugin-device", 51 | "cordova-plugin-splashscreen", 52 | "ionic-plugin-keyboard" 53 | ], 54 | "cordovaPlatforms": [ 55 | "ios", 56 | { 57 | "platform": "ios", 58 | "version": "", 59 | "locator": "ios" 60 | } 61 | ], 62 | "description": "internationalize-and-localize-your-ionic2-app: An Ionic project", 63 | "cordova": { 64 | "plugins": { 65 | "cordova-plugin-nativestorage": {}, 66 | "cordova-plugin-console": {}, 67 | "cordova-plugin-device": {}, 68 | "cordova-plugin-splashscreen": {}, 69 | "cordova-plugin-statusbar": {}, 70 | "cordova-plugin-whitelist": {}, 71 | "ionic-plugin-keyboard": {} 72 | }, 73 | "platforms": [ 74 | "ios" 75 | ] 76 | } 77 | } -------------------------------------------------------------------------------- /src/service-worker.js: -------------------------------------------------------------------------------- 1 | // tick this to make the cache invalidate and update 2 | const CACHE_VERSION = 1; 3 | const CURRENT_CACHES = { 4 | 'read-through': 'read-through-cache-v' + CACHE_VERSION 5 | }; 6 | 7 | self.addEventListener('activate', (event) => { 8 | // Delete all caches that aren't named in CURRENT_CACHES. 9 | // While there is only one cache in this example, the same logic will handle the case where 10 | // there are multiple versioned caches. 11 | const expectedCacheNames = Object.keys(CURRENT_CACHES).map((key) => { 12 | return CURRENT_CACHES[key]; 13 | }); 14 | 15 | event.waitUntil( 16 | caches.keys().then((cacheNames) => { 17 | return Promise.all( 18 | cacheNames.map((cacheName) => { 19 | if (expectedCacheNames.indexOf(cacheName) === -1) { 20 | // If this cache name isn't present in the array of "expected" cache names, then delete it. 21 | console.log('Deleting out of date cache:', cacheName); 22 | return caches.delete(cacheName); 23 | } 24 | }) 25 | ); 26 | }) 27 | ); 28 | }); 29 | 30 | // This sample illustrates an aggressive approach to caching, in which every valid response is 31 | // cached and every request is first checked against the cache. 32 | // This may not be an appropriate approach if your web application makes requests for 33 | // arbitrary URLs as part of its normal operation (e.g. a RSS client or a news aggregator), 34 | // as the cache could end up containing large responses that might not end up ever being accessed. 35 | // Other approaches, like selectively caching based on response headers or only caching 36 | // responses served from a specific domain, might be more appropriate for those use cases. 37 | self.addEventListener('fetch', (event) => { 38 | 39 | event.respondWith( 40 | caches.open(CURRENT_CACHES['read-through']).then((cache) => { 41 | return cache.match(event.request).then((response) => { 42 | if (response) { 43 | // If there is an entry in the cache for event.request, then response will be defined 44 | // and we can just return it. 45 | 46 | return response; 47 | } 48 | 49 | // Otherwise, if there is no entry in the cache for event.request, response will be 50 | // undefined, and we need to fetch() the resource. 51 | console.log(' No response for %s found in cache. ' + 52 | 'About to fetch from network...', event.request.url); 53 | 54 | // We call .clone() on the request since we might use it in the call to cache.put() later on. 55 | // Both fetch() and cache.put() "consume" the request, so we need to make a copy. 56 | // (see https://fetch.spec.whatwg.org/#dom-request-clone) 57 | return fetch(event.request.clone()).then((response) => { 58 | 59 | // Optional: add in extra conditions here, e.g. response.type == 'basic' to only cache 60 | // responses from the same domain. See https://fetch.spec.whatwg.org/#concept-response-type 61 | if (response.status < 400 && response.type === 'basic') { 62 | // We need to call .clone() on the response object to save a copy of it to the cache. 63 | // (https://fetch.spec.whatwg.org/#dom-request-clone) 64 | cache.put(event.request, response.clone()); 65 | } 66 | 67 | // Return the original response object, which will be used to fulfill the resource request. 68 | return response; 69 | }); 70 | }).catch((error) => { 71 | // This catch() will handle exceptions that arise from the match() or fetch() operations. 72 | // Note that a HTTP error response (e.g. 404) will NOT trigger an exception. 73 | // It will return a normal response object that has the appropriate error code set. 74 | console.error(' Read-through caching failed:', error); 75 | 76 | throw error; 77 | }); 78 | }) 79 | ); 80 | }); -------------------------------------------------------------------------------- /config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | internationalize-and-localize-your-ionic2-app 4 | An awesome Ionic/Cordova app. 5 | IonicThemes Team 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | --------------------------------------------------------------------------------