Problem: You want to support internationalization


Problem:
You want to support internationalization.
You want autocomplete support for translated strings.
You want type safety to ensure translations are available for all languages.

Solution:
Use TypeScript. Use functions for strings that need placeholders for dynamic content.

This approach has a tradeoff.

It's simple, and type safe. 👍
But it bloats the bundle if you have many translations. 👎

Options to scale if needed:
- Store translations with each page and lazy load each page
- Lazy load languages
- Consider i18next or similar
- Server render

View original on X