:clipboard: This project uses ngx translate, the internationalisation (i18n) library for Angular to change the content of the home page and alert button to the language chosen.
It allows access to a service, a directive and a pipe to handle any dynamic or static content. The main part of the library is the 'core'. A loader was added to load translations into the app.
Run ng lint to lint files - all files currently pass linting.
Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
๐ป Code Examples
language.service.ts function to set app language using option selected by user.
// sets default language as browser language if no other language choice made// if language language selected then this value is stored using the ionic storage modulesetInitialAppLanguage(){constlanguage=this.translate.getBrowserLang();this.translate.setDefaultLang('en');this.storage.get(LNG_KEY).then(val=>{if(val){this.setLanguage(val);this.selected=val;}});}
๐ Features
Select a language from the drop-down list and the language of headers, buttons, text alerts (as set up in the /assets/i18n/json files will change.