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
1.2k
2
Share
Type-Safe i18n on RN
@hotchemi
June 22, 2018
More Decks by @hotchemi
See All by @hotchemi
kompile-testing internal
hotchemi
0
290
The things we’ve learned from iOS×React Native hybrid development
hotchemi
2
5.5k
React Nativeを活用したアプリ開発体制/sapuri meetup
hotchemi
3
8.2k
Navigation in a hybrid app
hotchemi
3
1.4k
PermissionsDispatcher × Kotlin
hotchemi
0
3.4k
kotlin compiler plugin
hotchemi
1
820
Rx and Preferences
hotchemi
2
180
Introducing PermissionsDispatcher
hotchemi
1
180
khronos
hotchemi
4
2k
Other Decks in Programming
See All in Programming
OSもどきOS
arkw
0
400
プラグインで拡張される Context をtype-safe にする難しさと設計判断
kazupon
2
560
SPMマルチモジュールで テストカバレッジを取得する技法
yosshi4486
0
140
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
6
800
AIエージェントの隔離技術の徹底比較
kawayu
0
460
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
570
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
130
net-httpのHTTP/2対応について
naruse
0
430
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.5k
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
17
5.6k
tsserverとは何だったのか、これからどうなるのか
nowaki28
1
440
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
100
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Embracing the Ebb and Flow
colly
88
5.1k
Darren the Foodie - Storyboard
khoart
PRO
3
3.4k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Mind Mapping
helmedeiros
PRO
1
230
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
320
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
210
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
720
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
160
AI: The stuff that nobody shows you
jnunemaker
PRO
8
680
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
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!