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