本文整理汇总了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);
}