[React Intl] Format Numbers with Separators and Currency Symbols using react-intl FormattedNumber
2024-10-01 23:33:43
Using a react-intl
FormattedNumber
component, we'll pass a Number and a few additional props in order to render the correct separator and currency symbols for different languages.
For example we have price data as such:
"price": {
"en-US": "16.19",
"es-ES": "15.09",
"fr-FR": "15.09"
},
We can use FormattedNumber to display the correct currency.
let locale = (navigator.languages && navigator.languages[0])
|| navigator.language
|| navigator.userLanguage
|| 'en-US'; <p>
<FormattedNumber
style='currency'
currency={locale === 'en-US' ? 'USD': 'EUR'}
currencyDisplay='symbol'
value={merchant.price[locale]} />
</p>
最新文章
- 在Extjs中对日期的处理,以及在后端数据在SQL语句的判断处理
- windows 平台 php_Imagick 拓展遇到的那些坑!
- Linux SHELL 命令入门题目答案(一)
- _stdcall,_cdecl区别
- scrot使用
- 【BZOJ】1135: [POI2009]Lyz
- Spine批量导出Command line Export
- PHP 运行方式(PHP SAPI介绍)
- 关于updateElement接口
- python开发_mysqldb安装
- Win7下 httpRequest带证书请求https网站
- [Irving] SQL 2005/SQL 2008 备份数据库并自动删除N天前备份的脚本
- web版扫雷小游戏(四)
- 读书笔记—CLR via C#字符串及文本
- 解决 win10飞行模式 无限自动开关 无法关闭
- 【读书笔记】iOS-自定义 URL Scheme 完全指南
- WinAPI Hook
- spring-IOC容器(一)
- 低版本系统兼容的ActionBar(七)自定义Actionbar标题栏字体
- H5特性回顾
热门文章
- 游戏server之server优化思路
- 52. nodejs报错:Cannot find module &#39;ejs&#39;
- 14.字符串hash寻找第一个只出现一次的字符
- Impala与HBase整合
- Codefroces 415B Mashmokh and Tokens
- 2017国家集训队作业[agc006e]Rotate 3x3
- spring mvc 接收ajax 复杂结构数据
- aop 中joinpoint的使用方法
- start_kernel----lcokdep_init
- POJ 3461 Oulipo KMP算法题解