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
Type-Safe i18n on RN
Search
@hotchemi
June 22, 2018
Programming
2
1.1k
Type-Safe i18n on RN
@hotchemi
June 22, 2018
Tweet
Share
More Decks by @hotchemi
See All by @hotchemi
kompile-testing internal
hotchemi
0
240
The things we’ve learned from iOS×React Native hybrid development
hotchemi
2
5.1k
React Nativeを活用したアプリ開発体制/sapuri meetup
hotchemi
3
7.9k
Navigation in a hybrid app
hotchemi
3
1.3k
PermissionsDispatcher × Kotlin
hotchemi
0
3k
kotlin compiler plugin
hotchemi
1
720
Rx and Preferences
hotchemi
2
150
Introducing PermissionsDispatcher
hotchemi
1
140
khronos
hotchemi
4
1.9k
Other Decks in Programming
See All in Programming
ドメイン駆動設計とXPで支える子どもの未来 / Domain-Driven Design and XP Supporting Children's Future
nrslib
0
330
Duke on CRaC with Jakarta EE
ivargrimstad
1
310
医療系ソフトウェアのAI駆動開発
koukimiura
1
150
設計の本質:コード、システム、そして組織へ / The Essence of Design: To Code, Systems, and Organizations
nrslib
10
3.9k
Live Coding: Migrating an Application to Signals
manfredsteyer
PRO
0
120
ruby.wasmとWebSocketで遊ぼう!
lnit
0
120
クラス設計の手順
akikogoto
0
130
プロダクトエンジニアのしごと 〜 受託 × 高難度を乗り越えるOptium開発 〜
algoartis
0
250
ぽちぽち選択するだけでOSSを読めるVSCode拡張機能
ymbigo
14
6.6k
VitestのIn-Source Testingが便利
taro28
10
2.5k
ビカム・ア・コパイロット
ymd65536
1
170
In geheimer Mission: AI Agents entwickeln
joergneumann
0
130
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
75
5.8k
It's Worth the Effort
3n
184
28k
Thoughts on Productivity
jonyablonski
69
4.6k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
41
2.3k
How to Think Like a Performance Engineer
csswizardry
23
1.6k
Automating Front-end Workflow
addyosmani
1370
200k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Site-Speed That Sticks
csswizardry
6
560
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Building Adaptive Systems
keathley
41
2.5k
How to train your dragon (web standard)
notwaldorf
91
6k
Raft: Consensus for Rubyists
vanstee
137
6.9k
Transcript
Type-Safe i18n on RN Quipper Limited @hotchemi
7/19 Thu 19:30~22:00
react-native-i18n user?!
• It’s OK, but... • key name can be long
and nested • gotta move around definition and code • can’t detect an error in compile time • “missing [key name] translation”
None
• quipper/react-native-i18n-ts • paired with TypeScript • inspired by R.java
mechanism • strong IDE support • compile time check
Demo
• Under the hood • Generate d.ts file from definition
• with TypeScript compiler API
declare module "react-native-i18n" { var fallbacks: boolean; var translations: {
[keys: string]: any; }; function t(key: "common.cancel", opts: { value: any; }): string; function t(key: "common.ok"): string; } // for json loading declare module "*.json" { const value: any; export default value; }
• Installation • yarn add -D react-native-i18n-ts • set “model”
and “outputDir” in package.json • tweak filesGlob in tsconfig.json • execute “yarn i18n-ts” command
Enjoy!