Code Monkey home page Code Monkey logo

whiteducksoftware / angular-i18n-demo Goto Github PK

View Code? Open in Web Editor NEW
15.0 4.0 0.0 307 KB

This repository is accompanying our blogpost on Angular internationalization (i18n) in 2022. It demonstrates how to use the native Angular i18n library to translate your angular application at runtime.

Home Page: https://whiteduck.de/how-to-approach-angular-internationalization-i18n-in-2022/

License: MIT License

Dockerfile 18.04% Shell 0.51% JavaScript 9.50% TypeScript 61.42% HTML 7.82% SCSS 2.71%
angular i18n internationalization runtime-translations

angular-i18n-demo's Introduction

Angular i18n demo

This repository is accompanying our blogpost on Angular internationalization (i18n) in 2022. It demonstrates how to use the native Angular i18n library to translate your angular application at runtime. For more information see the blogpost.

How to run it

Navigate into the ./runtime-translations folder and run npm install to install the required dependencies. Then run npm run start to start the app in development mode.

How to use it

This demo implements runtime translations for the en and de languages. Click on the en or de button in the navbar to switch the language. It should translate the route label in the navbar and the app title displayed in the center.

How it is structured

  • The i18n.module.ts located in ./src/app/core/i18n/i18n.module.ts applies the selected language at application start-up and is the main component required for runtime translations.
  • The translation files are located in ./src/assets/i18n/ and are named en.json and de.json.
  • The language switch and storage of the selected language is done in the app-component.ts located in ./src/app/app-module.ts.

angular-i18n-demo's People

Contributors

m-voit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.