2

I just wanted to know how to provide translation support for my Angular 2.0.0(final) application which uses Webpack(1.13.2) for module bundling (not SystemJS).

I can get examples of Angular 2.0 i18n online, but all of those are done with SystemJS and not with Webpack.

Does anyone know how to do Angular2 i18n with Webpack ?

Appreciate your help in advance.

Vignesh Kumar
  • 193
  • 1
  • 1
  • 4

1 Answers1

0

You may want to follow the instructions below:

  1. Add import 'ng2-translate'
  2. Copy those i18n files to the assets folder. An example can be with the following plugin: new CopyWebpackPlugin([ { from: helpers.root('src', 'public', 'i18n'), to: 'assets/i18n' } ])

Taken from thread: https://github.com/ocombe/ng2-translate/issues/121

Update: In Angular 2 RC6 They have release a i18n support as you see here: http://angularjs.blogspot.com/2016/09/angular-2-rc6_1.html
You could use the TRANSLATIONS, TRANSLATIONS_FORMAT, LOCALE_ID barrel imports to utilize that. See an example here: https://github.com/StephenFluin/i18n-sample

Gabriel Kohen
  • 4,166
  • 4
  • 31
  • 46