当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript TranslateService.instant方法代码示例

本文整理汇总了TypeScript中ng2-translate/ng2-translate.TranslateService.instant方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TranslateService.instant方法的具体用法?TypeScript TranslateService.instant怎么用?TypeScript TranslateService.instant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ng2-translate/ng2-translate.TranslateService的用法示例。


在下文中一共展示了TranslateService.instant方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: getActionsConfig

    getActionsConfig(startWorkoutHandler, saveWorkoutHandler) {

        return {
            title: this.translate.instant('WORKOUT_COMPLETE_ACTIONS_TITLE'),
            buttons: [
                
                {
                    text: this.translate.instant('WORKOUT_COMPLETE_START_WORKOUT'),
                    icon: !this.platform.is('ios') ? 'play' : null,
                    cssClass: 'Workout-start',
                    handler: () => {}
                },
                
                {
                    text: this.translate.instant('WORKOUT_COMPLETE_SAVE'),
                    icon:  !this.platform.is('ios') ? 'list' : null,
                    cssClass: 'Workout-save',
                    handler: saveWorkoutHandler
                },
                
                {
                    text: this.translate.instant('WORKOUT_COMPLETE_CANCEL'),
                    role: 'cancel',
                    cssClass: 'Workout-cancel',
                    icon:  !this.platform.is('ios') ? 'close' : null,
                    handler: () => {}
                }
            ]
        };
    }
开发者ID:vadzim-kazak,项目名称:workout-log,代码行数:30,代码来源:workout-actions.provider.ts

示例2: handleAPIError

  /**
   * This method handles the bad responses of the backend
   * @param {Response} response Object with the server response
   * @return {Observable<Response>} Response with the error message
   */
  /* tslint:disable */
  public handleAPIError(response: Response): Observable<any> {
    /* tslint:enable */

    let message: string = '';
    let error: Error = Error.toObject(response.json().error);
    console.error(error);

    switch (error.status) {
      case 401:
        if (error.code === AppConfig.LOGIN_FAILED) {
          message = this.translateService.instant('ERROR.LOGIN_FAILED');
        }
        else if (error.code === AppConfig.LOGIN_FAILED_EMAIL_NOT_VERIFIED) {
          message = this.translateService.instant('ERROR.LOGIN_FAILED_EMAIL_NOT_VERIFIED');
        } else {
          // Unauthorized request (login again)
          location.reload();
        }
        break;
      case 500:
        message = this.translateService.instant('ERROR.INTERNAL_ERROR') + error.message;
        break;
      default:
        if (error.message) {
          message = error.message;
        } else {
          message = this.translateService.instant('ERROR.INTERNAL_ERROR');
        }
        break;
    }
    return Observable.throw(message);
  }
开发者ID:classpip,项目名称:classpip-mobile,代码行数:38,代码来源:utils.service.ts

示例3:

		this.freqObs = Observable.from(this.translate.getTranslation(Conf.lang).map(() => {
			return [
				{id: Freq.NONE, label: this.translate.instant('frequency.none')},
				{id: Freq.DAILY, label: this.translate.instant('frequency.daily')},
				{id: Freq.WEEKLY, label: this.translate.instant('frequency.weekly')},
				// {id: Freq.BIWEEKLY, label: this.translate.instant('frequency.biweekly')},
				{id: Freq.MONTHLY, label: this.translate.instant('frequency.monthly')},
				// {id: Freq.BIMONTHLY, label: this.translate.instant('frequency.bimonthly')}
			];
		}).toPromise());
开发者ID:architruc,项目名称:teacher-agenda,代码行数:10,代码来源:MiscService.ts

示例4: constructor

  constructor(
    public navController: NavController,
    public translateService: TranslateService,
    public utilsService: UtilsService,
    public ionicService: IonicService,
    public schoolService: SchoolService,
    private loginService: LoginService) {

    this.rootPage = HomePage;
    this.homePage = new Page(HomePage, this.translateService.instant('HOME.TITLE'));
    this.schoolPage = new Page(SchoolPage, this.translateService.instant('SCHOOL.TITLE'));
  }
开发者ID:classpip,项目名称:classpip-mobile,代码行数:12,代码来源:menu.ts

示例5: Notification

 let esub = contextProvider.editingObservable.subscribe(editing => {
     if(editing) {
         if(this.editingNotification === undefined) {
             this.editingNotification = new Notification('WARNING', translate.instant('edit.mode'));
         }
         this.notificationService.add('item', this.editingNotification);
     }
 });
开发者ID:DSpace-Labs,项目名称:angular2-ui-prototype,代码行数:8,代码来源:full-item-view.component.ts

示例6: showAlert

  /**
   * Displays an alert message with a confirmation button
   * on the screen
   * @param {string} title Title of the alert
   * @param {string} message Message to display
   */
  public showAlert(title: string, message: string): void {

    this.alertCtrl.create({
      title: title,
      subTitle: message,
      buttons: [this.translateService.instant('APP.OK')]
    }).present(prompt);
  }
开发者ID:classpip,项目名称:classpip-mobile,代码行数:14,代码来源:ionic.service.ts

示例7: createEditButton

 createEditButton(message, handler) {
   
   return {
       text: this.translate.instant(message),
       icon: !this.platform.is('ios') ? 'create' : null,
       cssClass: 'WorkoutAction-edit',
       handler
     } 
 }
开发者ID:vadzim-kazak,项目名称:workout-log,代码行数:9,代码来源:workouts-actions.provider.ts

示例8: onDelete

	/** Excludes this political party from the system. */
	onDelete() {
		const message = this.translate.instant('APP.CONFIRMATION');
		const confirm = window.confirm(message);
		if (confirm) {
			this.partyService.remove(this.party).subscribe(
				result => this.router.navigate(['/admin/party/list']),
				error => this.router.navigate(['/error', error.status], { skipLocationChange: true })
			);
		}
	}
开发者ID:andregs,项目名称:think-before-voting,代码行数:11,代码来源:party.component.ts

示例9: ngOnInit

 ngOnInit() {
     if (this.postId) {
         this.title = this.translate.instant('Edit Post');
         this.postsService.getPost(this.postId)
             .subscribe(res => {
                 this.form = this.fb.group({
                     id: res.id,
                     title: res.title,
                     contents: res.contents
                 })
             })
     } else {
         this.title = this.translate.instant('Create Post');
         this.form = this.fb.group({
             title: '',
             contents: ''
         })
     }
 }
开发者ID:kenfdev,项目名称:ng2-simple-spa,代码行数:19,代码来源:postEdit.component.ts


注:本文中的ng2-translate/ng2-translate.TranslateService.instant方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。