Angular TRANSLOCO库更改货币符号

huangapple go评论57阅读模式
英文:

Angular TRANSLOCO library change currency symbol

问题

我正在使用Angular的Transloco库https://ngneat.github.io/transloco/,我已经成功安装并尝试了示例https://ngneat.github.io/transloco/docs/plugins/locale/,所有示例都按预期工作。例如

<span>
   {{ 1000000 | translocoCurrency: 'symbol' : { minimumFractionDigits: 0 } }}
</span>

返回$1,000,000

现在我想将货币从$更改或本地化为尼日利亚货币(NGN),但我找不到方法。我已经查阅了文档,但没有找到有用的信息。

英文:

I am going through the Angular Transloco library https://ngneat.github.io/transloco/, I have successfully installed and tried the examples https://ngneat.github.io/transloco/docs/plugins/locale/ all worked as expected. For example

<span>
   {{ 1000000 | translocoCurrency: 'symbol' : { minimumFractionDigits: 0 } }}
</span>

returns $1,000,000

Now I want to change or localise the currency from $ to let's say the Nigerian currency (NGN) but I can't find a way of doing this. I have gone through the documentation but that wasn't helpful.

答案1

得分: 1

In TranslocoCurrencyPipe,'symbol'之后的下一个参数是货币代码。

因此,您应该这样做:

<span>
   {{ 1000000 | translocoCurrency: 'symbol' : { minimumFractionDigits: 0 }: 'NGN' }}
</span>
英文:

In TranslocoCurrencyPipe, the next parameter after 'symbol' is the currency code.

So you should do like this:

&lt;span&gt;
   {{ 1000000 | translocoCurrency: &#39;symbol&#39; : { minimumFractionDigits: 0 }: &#39;NGN&#39; }}
&lt;/span&gt;

huangapple
  • 本文由 发表于 2023年5月14日 20:21:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/76247451.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定