Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 禁止JhiAlertService使用TranslateService翻译消息_Javascript_Angular_Jhipster - Fatal编程技术网

Javascript 禁止JhiAlertService使用TranslateService翻译消息

Javascript 禁止JhiAlertService使用TranslateService翻译消息,javascript,angular,jhipster,Javascript,Angular,Jhipster,当我使用我的服务打印邮件时,JhiAlertService会尝试翻译邮件,如何禁用 从'@angular/core'导入{Injectable}; 从'@ngx translate/core'导入{TranslateService}; 从“ng jhipster”导入{JhiAlertService}; @注射的({ providedIn:'根' }) 导出类MessageServiceService{ 构造函数(公共翻译:TranslateService,公共警报服务:JhalertSer

当我使用我的服务打印邮件时,JhiAlertService会尝试翻译邮件,如何禁用

从'@angular/core'导入{Injectable};
从'@ngx translate/core'导入{TranslateService};
从“ng jhipster”导入{JhiAlertService};
@注射的({
providedIn:'根'
})
导出类MessageServiceService{
构造函数(公共翻译:TranslateService,公共警报服务:JhalertService){
this.getTranslations();
}
getTranslations(){
this.clientError1=this.translate.instant('global.error.clientError1');
this.clientError2=this.translate.instant('global.error.clientError2');
}
打印错误(名称、客户端号){
此为.alertService.error(
this.clientError1+名称+this.clientError2+客户端编号
);
}

}
不幸的是,我没有找到不激活翻译的方法

但是,要解决此问题,在参数之间传递变量就足够了,如下所示:

字符串:

MSG_STR: "Hello {{user}}"
警报命令:

this.alertService.error(MSG_STR, {user: 'Max'}));
结果:

Hello Max

您可以在他们的github repo上检查这个问题:在这个问题中,存在翻译消息的问题,我的问题是取消JhilertService尝试翻译的功能