forked from ngx-translate/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ng2-translate.ts
49 lines (45 loc) · 1.24 KB
/
ng2-translate.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import {NgModule, ModuleWithProviders} from "@angular/core";
import {Http, HttpModule} from "@angular/http";
import {TranslatePipe} from "./src/translate.pipe";
import {TranslateService, TranslateLoader, TranslateStaticLoader} from "./src/translate.service";
export * from "./src/translate.pipe";
export * from "./src/translate.service";
export * from "./src/translate.parser";
/**
* Deprecated, import the new TranslateModule in your NgModule instead
* @deprecated
*/
export const TRANSLATE_PROVIDERS: any = [
{
provide: TranslateLoader,
useFactory: (http: Http) => new TranslateStaticLoader(http),
deps: [Http]
},
TranslateService
];
// for angular-cli
export default {
pipes: [TranslatePipe],
providers: [TranslateService]
};
@NgModule({
imports: [],
declarations: [
TranslatePipe
],
exports: [
TranslatePipe
]
})
export class TranslateModule {
static forRoot(providedLoader: any = {
provide: TranslateLoader,
useFactory: (http: Http) => new TranslateStaticLoader(http),
deps: [Http]
}): ModuleWithProviders {
return {
ngModule: TranslateModule,
providers: [providedLoader, TranslateService]
};
}
}