- Notifications
You must be signed in to change notification settings - Fork1
aitorjs/angular-build-in-i18n
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Transladable string, translated to Spanish, English (base) and Basque.Working with AOT. Creates one app per language.
ng build --aot
Anadir un string como traducible:
Crear la pantilla general con todas las traduciones:ng xi18n --output-path src/i18n onpm 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 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-euatajos para servir la app en ingles, castellano o euskara )
- Abrirhttp://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"
- Buildear todos los idiomas:npm run build-i18n
- Copiar el contenido de dist, en el localhost de apache (npm run i18n-apache).
- Abrir en un navegadorhttp://localhost/es,http://localhost/en,http://localhost/fr
https://medium.com/@feloy/deploying-an-i18n-angular-app-with-angular-cli-fc788f17e358
For now, we are using Virtaal (http://virtaal.translatehouse.org/) that is multiplatformso whats on GNU/Linux (use apt), Windows and MacOs
UsingFile-> Update template can update language translation with last updates from base template keeping the translated strings.
This project was generated withAngular CLI version 1.1.3.
About
Playing with build-in internationalization (i18n) options
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Contributors3
Uh oh!
There was an error while loading.Please reload this page.