

Currency internationalization | eo-locale
source link: https://eo-locale.netlify.app/blog/money/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Currency internationalization
Maksim Sharipov
Maintainer of eo-localeIn this article we consider how to create clear and reusable component Money
.
For many websites it is actual issue to display prices in different currencies and for different languages.
It helps to be more friendly with customers from any country.
Let's figure requirements for those component:
- Ability to pass currency
- Ability to pass language, because for different languages we use different numeric format
- Mode of currency display
Actually, with @eo-locale/react
it is quite simple issue.
I am a big fan of TypeScript and all examples will use it.
Interface MoneyProps
extends interface Intl.NumberFormatOptions
, therefore
we can use any of standard params from Intl.NumberFormat.
For example, with next props:
Component will display $1,000.00
For change mode of currency display, set currencyDisplay
property.
It can be symbol
, code
or name
. By default symbol
.
Component will display 1,000.00 US dollars
If you want to show only one fraction digit, just pass maximumFractionDigits
and minimumFractionDigits
property.
Component will display $1,000.0
Recommend
-
44
I am trying to install package and doing some other work. But, getting the error that read as “ perl: warning: Setting loc...
-
11
PHP RFC: Locale-independent float to string cast Version: 1.0 Date: 2020-03-11
-
10
Open Bug 331779 Opened 15 years ago Updated 2 years ago
-
5
ubuntu 下设置 locale 报错 $ /usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory $ /usr/b...
-
261
warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory ...
-
12
解决 Arch Linux(KDE Plasma)中 Locale LANG=C 的问题 2021-10-08 约 243 字 预计阅读 1 分钟 3 次阅读 最近在 Arch Linux 上的 Git 显示不了中文,执行了
-
7
How to Set Locale and Add-Type in Krayin? You can change language and time zone from the Krayin CRM configuration setting. Here I wil...
-
5
Changing the Locale in Chrome with Dev Tools Mar 09, 2022 When working on internationalized apps, it's important to test different locales to ensure that the design looks acceptable for a wide range...
-
5
This post is part of my Byte Series, where I document tips, tricks, and tools that I've found useful.ProblemWhen building a localized JavaScript web-app, the default so...
-
6
Detect User Language (Locale) on Google App Engine Python Updated: February 21, 2015 The...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK