Skip to content

📋 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.

License

Notifications You must be signed in to change notification settings

AndrewJBateman/ionic-angular-localiser

Repository files navigation

⚡ Ionic Angular Localiser

GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

📄 Table of contents

📚 General info

  • "The ngx-translate, the internationalisation (i18n) library for Angular lets you define translations for your content in different languages and switch between them easily.
  • 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.

📷 Screenshots

Example screenshot Example screenshot Example screenshot

📶 Technologies

💾 Setup

  • Run npm i to install dependencies
  • 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 module
setInitialAppLanguage() {
  const language = 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.

📋 Status & To-Do List

  • Status: Working
  • To-Do: Nothing

👏 Inspiration

📁 License

  • This project is licensed under the terms of the MIT license.

✉️ Contact

About

📋 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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published