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


TypeScript TranslateService.get方法代码示例

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


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

示例1: sendContactForm

 sendContactForm() {
     if (!this.myForm.dirty && !this.myForm.valid)
         this.trans.get("FormNotValid").subscribe((res: string) => this.message = res);
     else {
         this.trans.get("MessagesContactUsSending").subscribe((res: string) => this.message = res);
         this.web.sendContactForm(this.myForm.value).subscribe(
             data => this.trans.get("MessagesSent").subscribe((res: string) => this.message = res),
             error => this.trans.get("MessagesSentContactUsError").subscribe((res: string) => this.message = res),
             () => this.trans.get("DoneContactUs").subscribe((res: string) => console.log(res))
         );
     }
 }
开发者ID:moleisking,项目名称:SAM,代码行数:12,代码来源:contactus-form.ts

示例2: login

 login() {
     if (!this.myForm.dirty && !this.myForm.valid)
         this.trans.get("FormNotValid").subscribe((res: string) => this.message = res);
     else {
         this.trans.get("UserSentLoggedIn").subscribe((res: string) => this.message = res);
         this.auth.login(this.myForm.value).subscribe(
             () => this.router.navigate(["/dashboard"]),
             error => this.trans.get("LoginNotPossible").subscribe((res: string) => this.message = res + error),
             () => this.trans.get("DoneContactUs").subscribe((res: string) => console.log(res))
         );
     }
 }
开发者ID:moleisking,项目名称:SAM,代码行数:12,代码来源:login-form.ts

示例3: constructor

    // Create instances off the data service and router service.
    constructor(private fruitService: FruitService, private router: Router, private translate: TranslateService) {
        const _router = this.router;

        // Instanciate and populate the dynamic columns array.
        // this.gridcols = new Array<wjcGrid.Column>();
        // this.gridcols.push(new wjcGrid.Column(({ header: 'Name', binding: 'common_name', width: 400 })));
        // this.gridcols.push(new wjcGrid.Column(({ header: 'Species', binding: 'species', width: 100 })));
        // this.gridcols.push(new wjcGrid.Column(({ header: 'Region', binding: 'region', width: 100 })));
        // this.gridcols.push(new wjcGrid.Column(({ header: 'Image', binding: 'ImageURL', width: 100 })));

        // Configure the Bento Toolbar with sample data.
        this.toolbarConfigurationData = [
            {
                label: 'Add',
                icon: 'bento-icon-add',
                action: () => {
                    console.log('add');
                }
            }, {
                label: 'Import',
                icon: 'bento-icon-enter',
                action: () => {
                    console.log('import');
                }
            }, {
                label: 'Export',
                icon: 'bento-icon-exit',
                action: () => {
                    console.log('export');
                }
            }, {
                label: 'Delete',
                icon: 'bento-icon-close-circle',
                action: () => {
                    console.log('delete');
                }
            },
            {
                // Vendor Button
                label: 'Vendors',
                icon: '',
                action: () => {_router.navigate(['fruit-vendor']);}
            }];

        translate.get('Common.Add').subscribe((res) => this.toolbarConfigurationData[0].label = res);
        translate.get('Common.Import').subscribe((res) => this.toolbarConfigurationData[1].label = res);
        translate.get('Common.Export').subscribe((res) => this.toolbarConfigurationData[2].label = res);
        translate.get('Common.Delete').subscribe((res) => this.toolbarConfigurationData[3].label = res);
        translate.get('Fruit.List.Vendors').subscribe((res) => this.toolbarConfigurationData[4].label = res);
    }
开发者ID:mcyemmy,项目名称:YemisArcade,代码行数:51,代码来源:list.component.ts

示例4: constructor

    constructor(private _store: Store<State>,
                private _translateService: TranslateService) {

        this._translateService
            .get("GENERIC_NO-RECORDS-FOUND")
            .subscribe(value => this.emptyListMessage = value);
    }
开发者ID:kraussj,项目名称:Showcase,代码行数:7,代码来源:airport-list.component.ts

示例5: translate

 private translate(message: string): string {
     let translation: string;
     this.translateService.get(message).subscribe(
         data => translation = data
     );
     return translation;
 }
开发者ID:NazDov,项目名称:myosbb,代码行数:7,代码来源:osbb-docs-and-reports.component.ts

示例6: show

 show(key: string, useAsIs = false) {
   if (!useAsIs) {
     this.translateService.get(key).subscribe(text => this.actuallyShow(text));
   }
   else {
     this.actuallyShow(key);
   }
 }
开发者ID:ActiverLtd,项目名称:Mobile,代码行数:8,代码来源:toast.service.ts

示例7: getTranslatedString

 getTranslatedString(data: any) {
   this.translateService.get(data).subscribe(
     (value: any) => {
       this.translatedResponse = value;
     }
   );
   return this.translatedResponse;
 }
开发者ID:HiP-App,项目名称:HiP-CmsAngularApp,代码行数:8,代码来源:notifications-list.component.ts

示例8: send

 send() {
     if (!this.myForm.dirty && !this.myForm.valid)
         this.trans.get("FormNotValid").subscribe((res: string) => this.message = res);
     else {
         this.user.forgottenpassword(this.myForm.value).subscribe(
             data => this.trans.get("PasswordSend").subscribe((res: string) => this.message = res),
             error => this.trans.get("ErrorSendingEmail").subscribe((res: string) => this.message = res),
             () => this.trans.get("DoneForgottenPassword").subscribe((res: string) => console.log(res))
         );
     }
 }
开发者ID:moleisking,项目名称:SAM,代码行数:11,代码来源:forgottenpassword-form.ts

示例9: changeForgottenPassword

  changeForgottenPassword(passwordForm: ChangePasswordModel): Observable<any> {
    if (passwordForm.newpassword !== passwordForm.confirmpassword) {
      let errorMsg: string;
      this.trans.get("ConfirmPasswordSame").subscribe((res: string) => errorMsg = res);
      return Observable.throw(errorMsg);
    }

    let body =
      "oldpassword=" + passwordForm.oldpassword +
      "&newpassword=" + passwordForm.newpassword +
      "&confirmpassword=" + passwordForm.confirmpassword;

    let headers = new Headers();
    headers.append("Content-Type", "application/x-www-form-urlencoded");

    return this.http.post(Settings.backend_url + "/changeforgottenpassword?locale=" + this.trans.currentLang, body,
      { headers: headers }).catch(this.handleError);
  }
开发者ID:moleisking,项目名称:SAM,代码行数:18,代码来源:user.ts

示例10: transform

  transform(elements: any): any[] {
    if (!elements) return [];

    let translations = [];
    for (let i = 0; i < elements.length; i++) {
      translations.push(elements[i].id);
    }

    this.translateService.get(translations, {}).subscribe((texts) => {
      for (let i = 0; i < elements.length; i++) {
        elements[i].translation = texts[elements[i].id];
      }
    });

    return elements.sort(function(a, b){
      if(a.translation < b.translation) return -1;
      if(a.translation > b.translation) return 1;
      return 0;
    });
  }
开发者ID:Ismaestro,项目名称:Packing-Up,代码行数:20,代码来源:order-alphabetically.pipe.ts


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