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
230
The things we’ve learned from iOS×React Native hybrid development
hotchemi
2
5k
React Nativeを活用したアプリ開発体制/sapuri meetup
hotchemi
3
7.7k
Navigation in a hybrid app
hotchemi
3
1.2k
PermissionsDispatcher × Kotlin
hotchemi
0
2.8k
kotlin compiler plugin
hotchemi
1
670
Rx and Preferences
hotchemi
2
140
Introducing PermissionsDispatcher
hotchemi
1
130
khronos
hotchemi
4
1.8k
Other Decks in Programming
See All in Programming
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
150
as(型アサーション)を書く前にできること
marokanatani
10
2.7k
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.5k
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
200
Remix on Hono on Cloudflare Workers
yusukebe
1
300
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
130
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
693
190k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Typedesign – Prime Four
hannesfritz
40
2.4k
GraphQLとの向き合い方2022年版
quramy
43
13k
Statistics for Hackers
jakevdp
796
220k
How GitHub (no longer) Works
holman
310
140k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Gamification - CAS2011
davidbonilla
80
5k
Adopting Sorbet at Scale
ufuk
73
9.1k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
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!