Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
React.js & i18n
Search
Eric Ferraiuolo
January 28, 2015
Programming
510
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
Transcript
24 slides
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
More Decks by Eric Ferraiuolo
See All by Eric Ferraiuolo
Node on the Road
ericf
1
140
Pure
ericf
7
1k
YUI and The Future
ericf
2
800
YUI 3.10.0 — Go Fast
ericf
3
620
YUI, Open Source, and Community
ericf
0
500
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
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
140
AI Augmentation Techniques with Liberty
ivargrimstad
1
560
読みやすい!と評判(?)の発表の準備にかける私のこだわり
shoheimitani
0
160
Math.sumPreciseから学ぶ、ECMAScript仕様の数値の種類
syumai
0
120
[DroidKnights 2026] Workflow AX: From Auto-Documented Policies to E2E Testing
raeminkang
0
610
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
390
将来の標準フォーマッター?ktfmtを深堀る
t45k
0
250
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
150
The Cost of the DOM
ypresto
2
210
テストだけで見つかる? Rubyでつくるメソッド発掘器
izawa
0
160
protojson における文字化けの扱い
kazuki1023
0
460
ローカルLLMの基本と近況 2611 / Local LLM basics and recent situation 2611
kishida
3
660
Featured
See All Featured
The Invisible Side of Design
smashingmag
301
52k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
2k
Code Reviewing Like a Champion
maltzj
529
40k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
How to train your dragon (web standard)
notwaldorf
96
6.9k
A designer walks into a library…
pauljervisheath
211
25k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.9k
My Coaching Mixtape
mlcsv
0
400
Darren the Foodie - Storyboard
khoart
PRO
5
4.1k
Building the Perfect Custom Keyboard
takai
2
970
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.4k