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
Eric Ferraiuolo
January 28, 2015
Programming
2
460
React.js & i18n
http://formatjs.io/
Eric Ferraiuolo
January 28, 2015
Tweet
Share
More Decks by Eric Ferraiuolo
See All by Eric Ferraiuolo
Node on the Road
ericf
1
94
Pure
ericf
7
940
YUI and The Future
ericf
2
700
YUI 3.10.0 — Go Fast
ericf
3
540
YUI, Open Source, and Community
ericf
0
410
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
GDG Super.init(version=6) - From Where to Wear : 모바일 개발자가 워치에서 발견한 인사이트
haeti2
0
510
Introduction to C Extensions
sylph01
3
150
イベントソーシングによってインピーダンスミスマッチから解放された話
tkawae
1
270
Generative AI for Beginners .NETの紹介
tomokusaba
1
260
CloudRun, Spanner に対する負荷試験の反省と オブザーバビリティによるアプローチ
oyasumipants
1
260
「その気にさせる」エンジニアが 最強のリーダーになる理由
gimupop
3
430
爆速スッキリ! Rspack 移行の成果と道のり - Muddy Web #11
dora1998
0
120
ステートソーシング型イベント駆動の視点で捉えるCQRS+ES
shinnosuke0522
0
270
Scala 3 で GLSL のための c-like-for を実装してみた
exoego
1
160
PHPのガベージコレクションを深掘りしよう
rinchoku
0
220
CSC486 Lecture 14
javiergs
PRO
0
140
OUPC2024 Day 1 解説
kowerkoint
0
380
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
32
6.5k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
176
52k
Optimising Largest Contentful Paint
csswizardry
34
3.1k
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.4k
Facilitating Awesome Meetings
lara
53
6.3k
Bash Introduction
62gerente
611
210k
A better future with KSS
kneath
238
17k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.2k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Docker and Python
trallard
44
3.3k
A Tale of Four Properties
chriscoyier
158
23k
Java REST API Framework Comparison - PWX 2021
mraible
29
8.4k
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