Git Product home page Git Product logo

angular-build-in-i18n's Introduction

Transladable string, translated to Spanish, English (base) and Basque. Working with AOT. Creates one app per language.

Steeps

  • ng build --aot

  • Anadir un string como traducible:

    Hello world!

  • Crear la pantilla general con todas las traduciones: ng xi18n --output-path src/i18n o npm run get-i18n

  • cp src/i18n/messages.xlf src/i18n/messages.es.xlf, suponiendo que queremos traducir la app a castellano.

  • Modificar la traducción en messages.es.xlf (la linea que tiene la etiqueta )

    <trans-unit id="[...]" datatype="html">
      <source>Hello World!</source>
      <target>Hola mundo!</target>
    </trans-unit>
    

Posibilidad 1:

  • Servir la aplicación en castellano: ng serve --aot --i18n-file=src/i18n/messages.es.xlf --locale=es --i18n-format=xlf (Eventualmente, npm run serve-en, npm run serve-es, npm run serve-eu atajos para servir la app en ingles, castellano o euskara )
  • Abrir http://localhost:4200

Posibilidad 2:

  • Añadir esta linea como script al pacakge.json paara build-ear la app:
"build-i18n": "for lang in en es fr; do ng build --output-path=dist/$lang --aot -prod --bh /$lang/ --i18n-file=src/i18n/messages.$lang.xlf --i18n-format=xlf --locale=$lang; done"

https://medium.com/@feloy/deploying-an-i18n-angular-app-with-angular-cli-fc788f17e358

I18n

This project was generated with Angular CLI version 1.1.3.

angular-build-in-i18n's People

Contributors

aitorjs avatar angular-cli avatar

Stargazers

 avatar

Watchers

 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.