在HTML中翻译
参考:https://www.cnblogs.com/echolun/p/12762839.html
<p>{{ 'key' | translate:'{ userName: "听风是风" }' }}</p>
<p translate="key" translate-values='{ userName: "听风是风"}'></p>
<p translate="key" translate-value-user-name='听风是风'></p>
在TS中翻译:
let ret = '';
this.translate.get(key).subscribe((res: string) => ret = res);
网友评论