0

i18nifty

 7 months ago
source link: https://www.i18nifty.dev/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

i18nifty

Type-safe internationalization and translation in React

A i18n library designed to leverage TypeScript's type inference capability.

Localization is much less of a chore when assisted by intellisense.

TypeScript let you know where and what translations need to be provided while allowing you explicitly fallback to the default language.

Try in a playground 🚀

Enable Copilot! 🦾

With GitHub Copilot enabled, translation is mostly a matter of supervision, even when there is logic involved!

Documentation

Production ready

SSR Ready

i18nifty features a great Next.js integration.
First print in the user's language read from HTTP header Accept-Language See for yourself.

Only the user's language translations downloaded

i18nifty provide an option for implementing code splitting, so that you avoid bundling every all translations for all languages in the main JS bundle. (Currently only available for SPAs).

React component and JS logic

Freely includes React components such as <a/> in your translations and involve JavaScript logic like message${plural?'s':''}.

Language defaults to browser preference

Language default to navigator.language if your app is an SPA or to ACCEPT-LANGUAGE HTTP Header if it's a Next.js app.

i18nifty automatically generates hreflang links in your <head> to let Google know that your site supports multiple languages.
The ?lang=xx URL parameter works out of the box.

Selected language persisted across reloads

The language is persisted across reloads using localStorage for SPA and using cookie for Next.js apps.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK