Releases: ngx-translate/core
v2.1.0
v2.0.0
v1.11.3
v1.11.2
v1.11.1
v1.11.0
<a name"1.11.0">
1.11.0 (2016-03-29)
Bug Fixes
- TranslateParser: allow keys with dots along with subkeys (692dccc0, closes #56)
- TranslateService:
- npm:
Features
BREAKING CHANGES:
Because of recent changes we have to use RxJS >= beta 2 and that means a recent version of Angular 2. You now have to upgrade to Angular beta 10 or more to use ng2-translate.
v1.10.3
v1.10.2
v1.10.1
v1.10.0
<a name"1.10.0">
1.10.0 (2016-03-06)
Features
- MissingTranslationHandler: the MissingTranslationHandler is now able to return a value or an o (23267b13)
- TranslateService: onLangChange now returns a LangChangeEvent instead of an object (e3087ac7)
BREAKING CHANGES:
The methods setMissingTranslationHandler
, useLoader
and useStaticFilesLoader
have been removed. It was not a good practice to change these after DI. You should use provide
instead, during bootstrap or in the providers
property of your component.
If you don't need to change anything to the default configuration just use TRANSLATE_PROVIDERS
:
import {HTTP_PROVIDERS} from 'angular2/http';
import {TRANSLATE_PROVIDERS} from 'ng2-translate/ng2-translate';
import {bootstrap} from 'angular2/platform/browser';
bootstrap(AppComponent, [
HTTP_PROVIDERS,
TRANSLATE_PROVIDERS
]);
If you need extra customisation you should use provide:
import {provide} from 'angular2/core';
import {HTTP_PROVIDERS} from 'angular2/http';
import {TranslateLoader, TranslateStaticLoader, TranslateService} from 'ng2-translate/ng2-translate';
import {bootstrap} from 'angular2/platform/browser';
bootstrap(AppComponent, [
HTTP_PROVIDERS,
provide(TranslateLoader, {
useFactory: (http: Http) => new TranslateStaticLoader(http, 'assets/i18n', '.json'),
deps: [Http]
}),
// use TranslateService here, and not TRANSLATE_PROVIDERS (which will define a default TranslateStaticLoader)
TranslateService
]);
You can also use provide to define this at a component level, just add it to the providers
property of your application.
If you use Ionic 2, you can customize the service like this:
import {provide} from 'angular2/core';
import {TranslateService, TranslateLoader, TranslateStaticLoader} from 'ng2-translate/ng2-translate';
@App({
templateUrl: '....',
config: {},
providers: [
provide(TranslateLoader, {
useFactory: (http: Http) => new TranslateStaticLoader(http, 'assets/i18n', '.json'),
deps: [Http]
}),
TranslateService
]
});