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


TypeScript core.TranslateService类代码示例

本文整理汇总了TypeScript中@ngx-translate/core.TranslateService的典型用法代码示例。如果您正苦于以下问题:TypeScript TranslateService类的具体用法?TypeScript TranslateService怎么用?TypeScript TranslateService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: constructor

    constructor(
        private translate: TranslateService,
        private cookie: CookieService,
        private session: SessionService,
        private appConfigService: AppConfigService,
        private titleService: Title) {
        // Override page title
        let key: string = "APP_TITLE.HARBOR";
        if (this.appConfigService.isIntegrationMode()) {
            key = "APP_TITLE.REG";
        }

        translate.get(key).subscribe((res: string) => {
            this.titleService.setTitle(res);
        });
    }
开发者ID:reasonerjt,项目名称:harbor,代码行数:16,代码来源:app.component.ts

示例2: constructor

    constructor(viewContainerRef: ViewContainerRef,
                private renderer: Renderer,
                private router: Router,
                private translate : TranslateService) {
        this.viewContainerRef = viewContainerRef;
        translate.addLangs(["ru", "cz", "en"]);
        translate.setTranslation("ru", RU);
        translate.setTranslation("en", EN);
        translate.setTranslation("cz", CZ);
        translate.setDefaultLang('ru');

        let browserLang = translate.getBrowserLang();
        translate.use(browserLang.match(/ru/) ? browserLang : 'ru');
    }
开发者ID:pozitivity,项目名称:demo,代码行数:14,代码来源:app.component.ts

示例3: getRecommendationLabel

    public getRecommendationLabel(motion: MotionBlockSlideMotionRepresentation): string {
        let recommendation = this.translate.instant(motion.recommendation.name);
        if (motion.recommendation_extension) {
            const extension = motion.recommendation_extension.replace(/\[motion:(\d+)\]/g, (match, id) => {
                const titleInformation = this.data.data.referenced_motions[id];
                if (titleInformation) {
                    return this.motionRepo.getIdentifierOrTitle(titleInformation);
                } else {
                    return this.translate.instant('<unknown motion>');
                }
            });

            recommendation += ' ' + extension;
        }
        return recommendation;
    }
开发者ID:jwinzer,项目名称:OpenSlides,代码行数:16,代码来源:motion-block-slide.component.ts

示例4: textToDocDef

    /**
     * Creates pdfmake definitions for basic information about the motion and
     * comments or notes
     *
     * @param note string optionally containing html layout
     * @param motion the ViewMotion this note refers to
     * @param noteTitle additional heading to be used (will be translated)
     * @returns pdfMake definitions
     */
    public textToDocDef(note: string, motion: ViewMotion, noteTitle: string): object {
        const title = this.createTitle(motion);
        const subtitle = this.createSubtitle(motion);
        const metaInfo = this.createMetaInfoTable(
            motion,
            this.configService.instant('motions_recommendation_text_mode'),
            ['submitters', 'state', 'category']
        );
        const noteContent = this.htmlToPdfService.convertHtml(note);

        const subHeading = {
            text: this.translate.instant(noteTitle),
            style: 'heading2'
        };
        return [title, subtitle, metaInfo, subHeading, noteContent];
    }
开发者ID:jwinzer,项目名称:OpenSlides,代码行数:25,代码来源:motion-pdf.service.ts

示例5: delete

    /**
     * Delete a file from the list.
     *
     * @param {number} index The index of the file.
     * @param {boolean} [askConfirm] Whether to ask confirm.
     */
    delete(index: number, askConfirm?: boolean): void {
        let promise;

        if (askConfirm) {
            promise = this.domUtils.showConfirm(this.translate.instant('core.confirmdeletefile'));
        } else {
            promise = Promise.resolve();
        }

        promise.then(() => {
            // Remove the file from the list.
            this.files.splice(index, 1);
        }).catch(() => {
            // User cancelled.
        });
    }
开发者ID:jleyva,项目名称:moodlemobile2,代码行数:22,代码来源:attachments.ts

示例6: exportCallList

 /**
  * Exports the call list.
  *
  * @param motions All motions in the CSV. They should be ordered by callListWeight correctly.
  */
 public exportCallList(motions: ViewMotion[]): void {
     this.csvExport.export(
         motions,
         [
             { label: 'Called', map: motion => (motion.sort_parent_id ? '' : motion.identifierOrTitle) },
             { label: 'Called with', map: motion => (!motion.sort_parent_id ? '' : motion.identifierOrTitle) },
             { label: 'submitters', map: motion => motion.submitters.map(s => s.short_name).join(',') },
             { property: 'title' },
             {
                 label: 'recommendation',
                 map: motion => (motion.recommendation ? this.motionRepo.getExtendedRecommendationLabel(motion) : '')
             },
             { property: 'motion_block', label: 'Motion block' }
         ],
         this.translate.instant('Call list') + '.csv'
     );
 }
开发者ID:CatoTH,项目名称:OpenSlides,代码行数:22,代码来源:motion-csv-export.service.ts

示例7: setMotionBlock

 /**
  * Opens a dialog and changes the motionBlock for all given motions.
  *
  * @param motions The motions for which to change the motionBlock
  */
 public async setMotionBlock(motions: ViewMotion[]): Promise<void> {
     const title = this.translate.instant('This will set the following motion block for all selected motions:');
     const clearChoice = 'Clear motion block';
     const selectedChoice = await this.choiceService.open(
         title,
         this.motionBlockRepo.getViewModelList(),
         false,
         null,
         clearChoice
     );
     if (selectedChoice) {
         for (const motion of motions) {
             const blockId = selectedChoice.action ? null : (selectedChoice.items as number);
             await this.repo.update({ motion_block_id: blockId }, motion);
         }
     }
 }
开发者ID:jwinzer,项目名称:OpenSlides,代码行数:22,代码来源:motion-multiselect.service.ts

示例8: resolve

 handler: data => {
   if (data.newPassword.length < 6) {
     this.meuToastService.present(this.translateService.instant('CHANGE_PASSWORD.ERROR'));
     return false;
   }
   this.authService.updatePassword(email, currentPassword, data.newPassword)
 .then(
   () => {
     this.meuToastService.present(this.translateService.instant('CHANGE_PASSWORD.SUCCESS'));
     resolve();
   }
 )
 .catch(err => {
   this.meuToastService.present(this.translateService.instant('COMMON_ERROR'));
   reject();
 });
 }
开发者ID:meumobi,项目名称:infomobi,代码行数:17,代码来源:login.ts

示例9: setLanguage

	// @desc: Set language by lang key, done after user interaction
	public setLanguage(key) {
		// Update language
		this.translateService.use(key);
		// Set/Update language in local storage for later use
		localStorage.setItem('language', key);
		// Update user language to server
		this.httpManagerService.post('/json/user/lang', {'uid': this.getUid(), 'lang': key}).subscribe(res => {
			forkJoin(
				this.translateService.get(res.alert.content),
				this.translateService.get('FORM_BUTTON_CLOSE'))
			.subscribe(([msg, action]) => {
				let snackBarRef = this.snackBar.open(msg, action, {
					'duration': 5000
				});
			});
		});
	}
开发者ID:openevocracy,项目名称:openevocracy,代码行数:18,代码来源:language.service.ts

示例10: initErrorMessages

    /**
     * Initialize some common errors if they aren't set.
     */
    protected initErrorMessages(): void {
        this.errorMessages = this.errorMessages || {};

        this.errorMessages.required = this.errorMessages.required || this.translate.instant('core.required');
        this.errorMessages.email = this.errorMessages.email || this.translate.instant('core.login.invalidemail');
        this.errorMessages.date = this.errorMessages.date || this.translate.instant('core.login.invaliddate');
        this.errorMessages.datetime = this.errorMessages.datetime || this.translate.instant('core.login.invaliddate');
        this.errorMessages.datetimelocal = this.errorMessages.datetimelocal || this.translate.instant('core.login.invaliddate');
        this.errorMessages.time = this.errorMessages.time || this.translate.instant('core.login.invalidtime');
        this.errorMessages.url = this.errorMessages.url || this.translate.instant('core.login.invalidurl');

        // Set empty values by default, the default error messages will be built in the template when needed.
        this.errorMessages.max = this.errorMessages.max || '';
        this.errorMessages.min = this.errorMessages.min || '';
    }
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:18,代码来源:input-errors.ts


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