-
Notifications
You must be signed in to change notification settings - Fork 0
/
ordens-servico.module.ts
53 lines (45 loc) · 1.65 KB
/
ordens-servico.module.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
50
51
52
53
import { HttpClient } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { EstoqueModule } from '../../estoque/estoque.module';
import { OrdemServicoComponent } from './ordem-servico/ordem-servico.component';
import { OrdensServicoComponent } from './ordens-servico.component';
const ROUTES: Routes = [
{ path: '', component: OrdensServicoComponent, pathMatch: 'full' },
{ path: 'criar', component: OrdemServicoComponent },
];
export function createTranslateLoader(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/erp/', '.json');
}
@NgModule({
entryComponents: [
],
providers: [
],
declarations: [
OrdensServicoComponent,
OrdemServicoComponent
],
imports: [
EstoqueModule,
RouterModule.forChild(ROUTES),
TranslateModule.forChild({
loader: {
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [HttpClient]
},
isolate: true,
}),
]
})
export class OrdensServicoModule {
constructor(private readonly translate: TranslateService) {
translate.addLangs(['en', 'pt-br']);
translate.setDefaultLang('pt-br');
const browserLang: string = translate.getBrowserLang();
translate.use(browserLang.match(/pt-br|en/) ? browserLang : 'pt-br');
}
}