ADD>>Package.json
1 |
"i18n": "ng-xi18n -p src/tsconfig.json --i18nFormat=xmb“ |
ADD>>tsconfig.json
1 2 |
"exclude": [ "test.ts" ] "angularCompilerOptions": { "genDir": "../src/locale" } |
1 2 |
COMMAND PROMPT)) npm run i18n COMMAND PROMPT)) ng build --aot --locale es --i18n-file src/locale/messages.es.xtb --i18n-format xtb |
Getting the locale in a component
ADD>> to any *.component.ts
1 2 3 4 5 |
import { LOCALE_ID } from '@angular/core'; constructor (@Inject(LOCALE_ID) locale: string) { moment.locale(locale); } |