Skip to content

Commit 676a664

Browse files
committed
resolved #114: provide LOCALE_ID
1 parent 3c0856b commit 676a664

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

angular/src/root.module.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { BrowserModule } from '@angular/platform-browser';
1+
import { BrowserModule } from '@angular/platform-browser';
22
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
3-
import { NgModule, Injector, APP_INITIALIZER } from '@angular/core';
3+
import { NgModule, Injector, APP_INITIALIZER, LOCALE_ID } from '@angular/core';
44

55
import { AbpModule, ABP_HTTP_PROVIDER } from '@abp/abp.module';
66

@@ -43,6 +43,10 @@ export function getRemoteServiceBaseUrl(): string {
4343
return AppConsts.remoteServiceBaseUrl;
4444
}
4545

46+
export function getCurrentLanguage(): string {
47+
return abp.localization.currentLanguage.name;
48+
}
49+
4650
@NgModule({
4751
imports: [
4852
BrowserModule,
@@ -64,10 +68,14 @@ export function getRemoteServiceBaseUrl(): string {
6468
useFactory: appInitializerFactory,
6569
deps: [Injector],
6670
multi: true
67-
}
71+
},
72+
{
73+
provide: LOCALE_ID,
74+
useFactory: getCurrentLanguage
75+
}
6876
],
6977
bootstrap: [RootComponent]
7078
})
7179
export class RootModule {
7280

73-
}
81+
}

0 commit comments

Comments
 (0)