zoukankan      html  css  js  c++  java
  • angular中的两种翻译

    1.就是{{'Save'|translate}} 就是在要翻译的后面直接加上translate
    2.对于弹出框...来说的 this.translateService.get().subscribe(....
    ① this.translateService.get(['This_Field_Is_Not_Less_Than','Characters']).subscribe(res=>{
    minlengthMessageStr= res['This_Field_Is_Not_Less_Than']+this.question.optionList[0].minText+ res['Characters']
    });


    ② this.translateService.get(["Close",message]).subscribe(async translated => {
    const alert = await this.alertController.create({
    header: '',
    message: translated[message],
    buttons: [
    {
    text: translated['Close'],
    role: 'cancel',
    cssClass: 'secondary',
    handler: (blah) => {
    console.log('Confirm Cancel: blah');
    }
    }
    ]
    });

    ③ this.translateService.get(["Please_Wait"]).subscribe(async translated => {
    this.loading = await this.loadingController.create({
    message: translated['Please_Wait'],
    showBackdrop: true,
    translucent: true,
    spinner: 'bubbles'
    });
    return await this.loading.present();

    要使用翻译要引入import { TranslateService } from '@ngx-translate/core';
    声明 public translateService:TranslateService

  • 相关阅读:
    UnityGUI Keynote
    Unity3D Asset 导入&导出
    Unity3d平台信息设置
    Unity3D自带Demo AngryBots路径
    如何判定Unity已破解成功
    fbx模型
    Init & Deinit & ARC
    Subscript & Inheritance
    Properties & Method
    Enumeration & Class & Structure
  • 原文地址:https://www.cnblogs.com/mmit/p/14119221.html
Copyright © 2011-2022 走看看