Keep Your UI Copy in One Place
All of the site's copy moves out of components into one central file, and components read it through `t('key')`. The keys are typed against that file, so they autocomplete, and a typo or a deleted line fails the type-check instead of shipping blank.
4 min read
#frontendCopy written inline drifts: the same label gets worded three ways, and
changing a sentence starts with a grep. Put all copy in one object
instead, grouped by the component that shows it, and read it through a
small t bound to that group. #typescript
turns the object's shape into the set of valid keys, so t('sayHi')
autocompletes and t('sayHello') doesn't compile.
@itsnas footer.tsx
codefooter.tsx
main
Nas (@itsnas)
main
Nas (@itsnas)