DEV Community

Cover image for I18n and React, a simple and easy solution
John B
John B

Posted on

3

I18n and React, a simple and easy solution

package

Internationalization can be a headache and is oftentimes heavy; both in terms of code size and overhead.

With this in mind, I wrote a very simple, lightweight package for react (7.1kB minified, no dependencies).

Unconventional features:

Backend independent

It can be linked to any backend. I assume here that the list of translations is stored somewhere on the internet (typically served from the backend).

Once loaded, the list of translations is stored in the local storage so that the application can be reloaded quickly.

Untranslated strings

I have always found it hard to know which strings were translated and which were not. With this package, we store all the untranslated strings in an array in the local storage, so that you can see at anytime all the missing strings - all you need to do is browse through the application.

Features

  • n languages
  • string interpolation
  • typescript
  • 0 dependencies
  • Built with react in mind, but can be used with any JS framework.

Get it!

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay