-
Notifications
You must be signed in to change notification settings - Fork 8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(localization): implement the localization using ngx-translate (#830
- Loading branch information
1 parent
56638e7
commit 627d62d
Showing
15 changed files
with
151 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { Http, HttpModule } from '@angular/http'; | ||
|
||
import { TranslateModule, TranslateLoader } from "@ngx-translate/core"; | ||
import { TranslateHttpLoader } from "@ngx-translate/http-loader"; | ||
import { TranslateService } from '@ngx-translate/core'; | ||
|
||
export function createTranslateLoader(http: Http) { | ||
return new TranslateHttpLoader(http, './assets/i18n/US/', '.json'); | ||
} | ||
|
||
const translationOptions = { | ||
loader: { | ||
provide: TranslateLoader, | ||
useFactory: (createTranslateLoader), | ||
deps: [Http] | ||
} | ||
}; | ||
|
||
@NgModule({ | ||
imports: [TranslateModule.forRoot(translationOptions)], | ||
exports: [TranslateModule], | ||
providers: [TranslateService] | ||
}) | ||
export class AppTranslationModule { | ||
constructor(private translate: TranslateService) { | ||
translate.addLangs(["en"]); | ||
translate.setDefaultLang('en'); | ||
translate.use('en'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.