本文整理匯總了TypeScript中ng2-translate/ng2-translate.TranslateService類的典型用法代碼示例。如果您正苦於以下問題:TypeScript TranslateService類的具體用法?TypeScript TranslateService怎麽用?TypeScript TranslateService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了TranslateService類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(private translate: TranslateService, private _router:Router){
translate.addLangs(['pl', 'en']);
translate.use(AppSettings._language);
}
示例2: constructor
constructor(private http: Http, private translate: TranslateService){
translate.use(AppSettings._language);
}
示例3: constructor
/**
*
* @param translate
* TranslateService
*/
constructor(private translate: TranslateService) {
translate.setDefaultLang('en');
translate.use('en');
}
示例4: constructor
constructor(private router: Router, private translate: TranslateService) {
translate.setDefaultLang('vi');
translate.use('vi');
this.pageInfo = new WrapperInfo(false);
this.alertInfo = [];
}
示例5: constructor
constructor(translate: TranslateService) {
console.log('Starting App!');
translate.setDefaultLang('en');
translate.use('en');
}
示例6: onWhenAddingFileFailed
/**
* Override callback method. This method is called if a file cannot be added to the queue
*/
public onWhenAddingFileFailed(fileItem:any, filter:any, options:any):any {
this.notificationService.notify('app', 'DANGER', this.translate.instant('item.file-upload.queue.error', { name: fileItem.file.name }));
}
示例7:
toggleLanguage() {
const lang = this.translate.currentLang === 'pt' ? 'en' : 'pt';
this.translate.use(lang);
}
示例8:
error => {
this.toastr.error(
this.translateService.instant('soe.toast.failed'),
this.translateService.instant('soe.toast.error'));
});
示例9: setLang
setLang(lang) {
this.actLang = lang;
this.translate.use(lang);
}
示例10: setTranslateConfig
setTranslateConfig():void {
var userLang = navigator.language.split('-')[0];
this.app.lang = /(fr|en)/gi.test(userLang) ? userLang : 'en';
this.translate.setDefaultLang('en');
this.translate.use(this.app.lang);
}