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
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
230
The things we’ve learned from iOS×React Native hybrid development
hotchemi
2
4.9k
React Nativeを活用したアプリ開発体制/sapuri meetup
hotchemi
3
7.6k
Navigation in a hybrid app
hotchemi
3
1.1k
PermissionsDispatcher × Kotlin
hotchemi
0
2.5k
kotlin compiler plugin
hotchemi
1
640
Rx and Preferences
hotchemi
2
140
Introducing PermissionsDispatcher
hotchemi
1
130
khronos
hotchemi
4
1.8k
Other Decks in Programming
See All in Programming
From Spring Boot 2 to Spring Boot 3 with Java 22 and Jakarta EE
ivargrimstad
0
580
AWS CDKにおける「再利用性」を考える / aws-cdk-reusability
gotok365
4
580
Micro Frontends for Java Microservices - KCDC 2024
mraible
PRO
1
280
Kotlin Script 활용하기
kciter
0
160
CSC307 Lecture 01
javiergs
PRO
0
300
Tap it! Shake it! Fling it! Sheep it! The Gesture Animations Dance!
kwakeuijin
0
150
開発生産性の観点から考える自動テスト(2024/06版) / Automated Test Knowledge from Savanna 202406 Findy dev-prod-con edition
twada
PRO
18
8.9k
KotlinのLinter まなびなおし2024
nyafunta9858
0
2.6k
キッティングツールによる自動化でセットアップ時間を1時間から3分に短縮
mot_techtalk
2
180
CSC307 Lecture 04
javiergs
PRO
0
220
What's new in Xcode 16 ダイジェスト
enomotok
0
230
CSC307 Lecture 03
javiergs
PRO
0
170
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
501
140k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
15
1.6k
A better future with KSS
kneath
231
17k
Code Review Best Practice
trishagee
57
16k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
228
16k
Making Projects Easy
brettharned
110
5.6k
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
Design by the Numbers
sachag
277
18k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
Teambox: Starting and Learning
jrom
129
8.5k
Debugging Ruby Performance
tmm1
70
11k
The Language of Interfaces
destraynor
151
23k
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!