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
5.1k
React Nativeを活用したアプリ開発体制/sapuri meetup
hotchemi
3
7.8k
Navigation in a hybrid app
hotchemi
3
1.2k
PermissionsDispatcher × Kotlin
hotchemi
0
2.9k
kotlin compiler plugin
hotchemi
1
700
Rx and Preferences
hotchemi
2
140
Introducing PermissionsDispatcher
hotchemi
1
140
khronos
hotchemi
4
1.9k
Other Decks in Programming
See All in Programming
ML.NETで始める機械学習
ymd65536
0
220
dbt Pythonモデルで実現するSnowflake活用術
trsnium
0
240
『GO』アプリ バックエンドサーバのコスト削減
mot_techtalk
0
150
コードを読んで理解するko build
bells17
1
100
PHP ステートレス VS ステートフル 状態管理と並行性 / php-stateless-stateful
ytake
0
110
SwiftUI Viewの責務分離
elmetal
PRO
2
260
Serverless Rust: Your Low-Risk Entry Point to Rust in Production (and the benefits are huge)
lmammino
1
140
Jakarta EE meets AI
ivargrimstad
0
130
Better Code Design in PHP
afilina
0
160
5分で理解する SOLID 原則 #phpcon_nagoya
shogogg
1
280
GitHub Actions × RAGでコードレビューの検証の結果
sho_000
0
280
XStateを用いた堅牢なReact Components設計~複雑なClient Stateをシンプルに~ @React Tokyo ミートアップ #2
kfurusho
1
950
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
114
50k
A designer walks into a library…
pauljervisheath
205
24k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
12
980
KATA
mclloyd
29
14k
Optimising Largest Contentful Paint
csswizardry
34
3.1k
Large-scale JavaScript Application Architecture
addyosmani
511
110k
The Cost Of JavaScript in 2023
addyosmani
47
7.3k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
40
2k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
How to train your dragon (web standard)
notwaldorf
91
5.9k
Automating Front-end Workflow
addyosmani
1368
200k
A Modern Web Designer's Workflow
chriscoyier
693
190k
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!