當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。