AngularJS, Jade and i18n

@gruizdevilla

Simple technique for having (pre)translated templates

Steps

  1. Texts stored in JSON documents
  2. Jade templates
  3. Translated texts are accessed
    with #{i18n.the.text.code}
  4. Templates are compiled to:
    • template.es.html
    • template.en.html
    • ...
  5. AngularJS interceptor dynamically changes template url before loading it.

Demo

AngularJS, Jade and i18n

By Gonzalo Ruiz de Villa

AngularJS, Jade and i18n

  • 3,015