Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
React.js & i18n
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Eric Ferraiuolo
January 28, 2015
Programming
490
2
Share
React.js & i18n
http://formatjs.io/
Eric Ferraiuolo
January 28, 2015
More Decks by Eric Ferraiuolo
See All by Eric Ferraiuolo
Node on the Road
ericf
1
130
Pure
ericf
7
990
YUI and The Future
ericf
2
770
YUI 3.10.0 — Go Fast
ericf
3
610
YUI, Open Source, and Community
ericf
0
470
Advocatus Diaboli – Throne of JS
ericf
8
16k
Y.App: Coordinating URL Navigation, Routing, and Managing Views
ericf
10
2.1k
Other Decks in Programming
See All in Programming
UaaL×Androidアプリのメモリ計測 — Memory Profilerの先へ
rio432
0
160
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
370
Are We Really Coding 10× Faster with AI?
kohzas
0
180
ハーネスエンジニアリングとは?
kinopeee
13
7k
〜バイブコーディングを超えて〜 チームで実験し続けたAI駆動開発
tigertora7571
0
210
「なんか〇〇ライブラリで脆弱性あるみたいなんだけど。。。」から始める脆弱性対応 / First Steps in Vulnerability Response
mackey0225
2
130
Oxlintはいかにしてtsgolintのlint ruleを呼び出しているのか
syumai
0
170
TypeScriptだけでAIエージェントを作る フロント・エージェント・インフラのフルスタック実践
har1101
1
350
KMP × Kotlin 2.3 - How Android Got Slower While iOS Builds Improved by 47%
rio432
0
200
Kubernetesを使わない環境にもCloud Nativeなデプロイを実現する / Enabling Cloud Native deployments without the complexity of Kubernetes
linyows
3
410
GitHubCopilotCLIをはじめよう.pdf
htkym
0
330
Firefoxにコントリビューションして得られた学び
ken7253
2
160
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Between Models and Reality
mayunak
4
290
Agile that works and the tools we love
rasmusluckow
331
21k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
800
A Soul's Torment
seathinner
6
2.8k
Ruling the World: When Life Gets Gamed
codingconduct
0
230
Six Lessons from altMBA
skipperchong
29
4.2k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
Odyssey Design
rkendrick25
PRO
2
620
Reality Check: Gamification 10 Years Later
codingconduct
0
2.1k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Transcript
React.js & i18n @ericf - Yahoo ReactConf
1.002 2/1/2015
But I only care about English in the USA!
English 5.2% 27% Native Speakers Internet Users Source: Wikipedia
None
None
None
Formatting
None
None
function numberWithCommas(x) { var parts = x.toString().split("."); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g,
","); return parts.join("."); } “How to print a number with commas as thousands separators in JavaScript?” 25 Answers
Intl.NumberFormat Intl.DateTimeFormat Intl.Collator
new Intl.NumberFormat().format(1000); new Intl.DateTimeFormat({ month: 'long', day : 'numeric', year
: 'numeric' }).format(Date.now()); 1,000 January 28, 2015 Intl Built-ins
<FormattedNumber value={1000} /> <FormattedDate value={Date.now()} month="long" day="numeric" year="numeric" /> React
Intl 1,000 January 28, 2015
<p className=“post-meta”> Posted <FormattedRelative value={this.props.date} /> </p> Relative Times Posted
3 hours ago
“Hello, {name}!” “You’re {age, number} years old.” String Messages
var msg = `{numComments, plural, one {# comment}
other {# comments} }`; <FormattedMessage message={msg} numComments={1} /> Pluralization 1 comment
var msg = `{numComments, plural, one {# comment}
other {# comments} }`; <FormattedMessage message={msg} numComments={1200} /> Pluralization 1,200 comments
var App = React.createClass({ mixins: [IntlMixin], render: function () {
return <FormattedNumber value={this.props.price} style="currency" currency="USD" /> } }); React.render( <App locales="fr-FR" price={1099.95} />, document.getElementById("container") ); Intl Mixin 1 099,95 $US
7.7k 150+ React Intl min + gz languages English as
default
None
CLDR ICU JS Runtimes (Intl.*) Format.js Core Format.js Integrations
Intl.MessageFormat Intl.RelativeFormat Future Intl Built-ins?
Questions? formatjs.io @ericf - Yahoo ReactConf