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
500
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
140
Pure
ericf
7
990
YUI and The Future
ericf
2
790
YUI 3.10.0 — Go Fast
ericf
3
620
YUI, Open Source, and Community
ericf
0
490
Advocatus Diaboli – Throne of JS
ericf
8
16k
Y.App: Coordinating URL Navigation, Routing, and Managing Views
ericf
10
2.2k
Other Decks in Programming
See All in Programming
ALB ログから Trace を気合で繋げる技術
fohte
3
360
源内ハンズオン概要編
hideg
0
210
freee が目指す データ マネジメント戦略 AI-Ready 時代を支える 攻めのガバナンスとは
freee
PRO
0
480
Loosening the Reins: Go Generics Get More Flexible
kuro_kurorrr
0
320
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
210
ここ半年くらいでAIに作らせたR用ツール
eitsupi
0
400
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
380
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
540
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
350
進化を続けるGo toolsの現在地 / The Current State of Ever-Evolving Go Tools
hond0413
0
260
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.5k
30年振りにコンパイラの定数整数除算を改善した
herumi
9
4.2k
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
6.2k
Odyssey Design
rkendrick25
PRO
2
780
The Limits of Empathy - UXLibs8
cassininazir
1
610
Leo the Paperboy
mayatellez
8
2.2k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.2k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
57k
Code Reviewing Like a Champion
maltzj
528
40k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
What's in a price? How to price your products and services
michaelherold
247
13k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
550
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
620
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.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