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
93
Pure
ericf
7
930
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
2k
Other Decks in Programming
See All in Programming
ARA Ansible for the teams
kksat
0
150
pylint custom ruleで始めるレビュー自動化
shogoujiie
0
120
Domain-Driven Transformation
hschwentner
2
1.9k
SwiftUI Viewの責務分離
elmetal
PRO
1
230
Rails アプリ地図考 Flush Cut
makicamel
1
120
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
220
第3回 Snowflake 中部ユーザ会- dbt × Snowflake ハンズオン
hoto17296
4
370
Compose でデザインと実装の差異を減らすための取り組み
oidy
1
310
CloudNativePGがCNCF Sandboxプロジェクトになったぞ! 〜CloudNativePGの仕組みの紹介〜
nnaka2992
0
230
『GO』アプリ バックエンドサーバのコスト削減
mot_techtalk
0
140
Software Architecture
hschwentner
6
2.1k
WebDriver BiDiとは何なのか
yotahada3
1
140
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
4
410
Facilitating Awesome Meetings
lara
52
6.2k
What's in a price? How to price your products and services
michaelherold
244
12k
The Power of CSS Pseudo Elements
geoffreycrofte
75
5.5k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
9
440
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.8k
Documentation Writing (for coders)
carmenintech
67
4.6k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.2k
We Have a Design System, Now What?
morganepeng
51
7.4k
A Tale of Four Properties
chriscoyier
158
23k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
12
960
A Modern Web Designer's Workflow
chriscoyier
693
190k
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