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


TypeScript TranslateService.get方法代码示例

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


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

示例1: updateTitle

 /**
  * update the window title using params in the following
  * precendence
  * 1. titleKey parameter
  * 2. $state.$current.data.pageTitle (current state page title)
  * 3. 'global.title'
  */
 updateTitle(titleKey?: string) {
     if (!titleKey && this.$state.current.data && this.$state.current.data.pageTitle) {
         titleKey = this.$state.current.data.pageTitle;
     }
     this.translateService.get(titleKey || 'global.title').subscribe(title => {
         window.document.title = title;
     });
 }
开发者ID:lrkwz,项目名称:generator-jhipster,代码行数:15,代码来源:_language.helper.ts

示例2: updateTitle

    /**
     * Update the window title using params in the following
     * order:
     * 1. titleKey parameter
     * 2. $state.$current.data.pageTitle (current state page title)
     * 3. 'global.title'
     */
    updateTitle(titleKey?: string) {
        if (!titleKey) {
             titleKey = this.getPageTitle(this.router.routerState.snapshot.root);
        }

        this.translateService.get(titleKey).subscribe(title => {
            this.titleService.setTitle(title);
        });
    }
开发者ID:Anuj28282828,项目名称:tutorials,代码行数:16,代码来源:language.helper.ts

示例3: updateTitle

    /**
     * update the window title using params in the following
     * precendence
     * 1. titleKey parameter
     * 2. $state.$current.data.pageTitle (current state page title)
     * 3. 'global.title'
     */
    updateTitle(titleKey?: string) {

        if (!titleKey && this.titleService.getTitle() ) {
            titleKey = this.titleService.getTitle();
        }

        this.translateService.get(titleKey || 'global.title').subscribe(title => {
            this.titleService.setTitle(title);
        });
    }
开发者ID:bonhamcm,项目名称:generator-jhipster,代码行数:17,代码来源:_language.helper.ts

示例4: constructor

 constructor(public translate: TranslateService, public storage: StorageService) {
   this.translate.get("salute")
     .subscribe(
     (data) => {
       console.log(`${data} from home.ts`);
     },
     (error) => {
       console.log(error);
     });      
 }
开发者ID:alvaromorenomorales,项目名称:Ionic-v2-seed-template,代码行数:10,代码来源:home.ts

示例5: toast

	toast(friendlyErrorMessageKey:string):void {
		this.translate.get(friendlyErrorMessageKey).subscribe((message:string) => {
			let nav:NavController = this.app.getActiveNav();
			let toast:Toast = Toast.create({
				message: message,
				duration: message.length * 100 + 2000
			});
			nav.present(toast);
		});
	}
开发者ID:architruc,项目名称:teacher-agenda,代码行数:10,代码来源:Toaster.ts

示例6: constructor

	constructor(translate: TranslateService) {
		var userLang = navigator.language.split('-')[0]; // use navigator lang if available
        
        // this language will be used as a fallback when a translation isn't found in the current language
        translate.setDefaultLang('en');

        /*translate.setTranslation('en', {
		    "FOO": "foo worked"
		});*/
 
        // the lang to use, if the lang isn't available, it will use the current loader to get them
        translate.use(userLang);
        console.log(translate.get('THATITLE'), translate.get('FOO'));
    }
开发者ID:mowses,项目名称:angular2-seed,代码行数:14,代码来源:app.component.ts

示例7: ngOnInit

    ngOnInit() {
        this.translate.get(['_about.OMA', '_about.Founder', '_about.Manager', '_about.Analyst', '_about.Designer', '_about.Marketer', '_about.Editor', '_about.Developer', '_about.Tester', '_about.Support']).subscribe((t: string[]) => {
            this.members = [
                new TeamMember('Jacek Kościesza', t['_about.OMA'], 'http://www.ronbrauner.com/i/copywriter-multiple-personality.jpg'),
                new TeamMember('Jacek Kościesza', t['_about.Founder'], 'https://media.licdn.com/mpr/mpr/shrinknp_200_200/AAEAAQAAAAAAAAbJAAAAJGM3MDMwMTA5LWUzYmQtNGFiYy1hOWJiLTI1MjBjNDE0OWFhNQ.jpg'),
                new TeamMember('Jacek Kościesza', t['_about.Manager'], 'https://static.goldenline.pl/user_photo/250/user_1571834_4133dd_huge.jpg'),
                new TeamMember('Jacek Kościesza', t['_about.Analyst'], 'https://static.goldenline.pl/user_photo/250/user_1571834_4133dd_huge.jpg'),
                new TeamMember('Jacek Kościesza', t['_about.Designer'], 'https://static.goldenline.pl/user_photo/250/user_1571834_4133dd_huge.jpg'),
                new TeamMember('Jacek Kościesza', t['_about.Marketer'], 'https://static.goldenline.pl/user_photo/250/user_1571834_4133dd_huge.jpg'),
                new TeamMember('Jacek Kościesza', t['_about.Editor'], 'https://static.goldenline.pl/user_photo/250/user_1571834_4133dd_huge.jpg'),
                new TeamMember('Jacek Kościesza', t['_about.Developer'], 'https://static.goldenline.pl/user_photo/250/user_1571834_4133dd_huge.jpg'),
                new TeamMember('Jacek Kościesza', t['_about.Tester'], 'https://static.goldenline.pl/user_photo/250/user_1571834_4133dd_huge.jpg'),
                new TeamMember('Jacek Kościesza', t['_about.Support'], 'https://static.goldenline.pl/user_photo/250/user_1571834_4133dd_huge.jpg')
            ]
        });

    }
开发者ID:JacekKosciesza,项目名称:InvestSystemsOrg,代码行数:17,代码来源:team.tab.ts

示例8: constructor

 constructor(public translate: TranslateService, public mdIconRegistry: MdIconRegistry) {
   console.log('entra a constructor');
   this.translate.get("salute")
     .subscribe(
     (data) => {
       console.log(data + " from home.ts");
     },
     (error) => {
       console.log(error);
     });
     
   // mdIconRegistry
   //   .addSvgIcon('thumb-up', '/demo-app/icon/assets/thumbup-icon.svg')
   //   .addSvgIconSetInNamespace('core', '/demo-app/icon/assets/core-icon-set.svg')
   //   .registerFontClassAlias('fontawesome', 'fa');
     
   // mdIconRegistry
   //   .addSvgIconSetInNamespace('core', 'material/css/materialdesignicons.min.css');
   
 }
开发者ID:alvaromorenomorales,项目名称:Angular-v2-seed-template,代码行数:20,代码来源:index.ts

示例9: get

 get(key: string, interpolateParams: any): Observable<string> {
   return this.translate.get(`validations.${key}`, interpolateParams);
 }
开发者ID:tb,项目名称:ng2-formsy,代码行数:3,代码来源:validations.form.ts

示例10: ngOnInit

 ngOnInit() {
   this.translate.get('TITLE')
     .subscribe(title => this.setTitle(title));
 }
开发者ID:yang-xiaodong,项目名称:AspNetCoreSpa,代码行数:4,代码来源:app.component.ts


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