react-i18next vs react-intl vs react-intl-universal
国際化ライブラリ
react-i18nextreact-intlreact-intl-universal類似パッケージ:

国際化ライブラリ

国際化ライブラリは、アプリケーションを多言語対応にするためのツールです。これらのライブラリは、テキストの翻訳、日付や数値のフォーマット、ローカライズされたコンテンツの管理を容易にします。これにより、ユーザーは自分の言語でアプリケーションを利用でき、より良いユーザー体験を提供します。

npmのダウンロードトレンド

3 年

GitHub Starsランキング

統計詳細

パッケージ
ダウンロード数
Stars
サイズ
Issues
公開日時
ライセンス
react-i18next09,933910 kB01日前MIT
react-intl014,687240 kB212日前BSD-3-Clause
react-intl-universal0-71.1 kB-6ヶ月前BSD-3-Clause

機能比較: react-i18next vs react-intl vs react-intl-universal

翻訳管理

  • react-i18next:

    react-i18nextは、翻訳キーと翻訳文をJSONファイルで管理でき、動的な翻訳の更新が可能です。ネストされた翻訳や複雑な構造の翻訳もサポートしており、柔軟性があります。

  • react-intl:

    react-intlは、メッセージを定義するためのシンプルなAPIを提供し、翻訳文を直接コンポーネントに埋め込むことができます。これにより、翻訳の管理が容易になります。

  • react-intl-universal:

    react-intl-universalは、翻訳ファイルを簡単にロードし、必要に応じて翻訳を切り替えることができます。シンプルな設定で、開発者が迅速に国際化を実装できます。

日付と数値のフォーマット

  • react-i18next:

    react-i18nextは、日付や数値のフォーマットを簡単に行うための機能を提供します。i18nextの強力なフォーマッタを利用して、ローカライズされた形式で表示できます。

  • react-intl:

    react-intlは、Intl APIを利用して、地域に応じた日付や数値のフォーマットを自動的に行います。これにより、ユーザーの地域に適した表示が可能です。

  • react-intl-universal:

    react-intl-universalは、簡単なAPIを通じて日付や数値のフォーマットを提供します。特に、サーバーサイドレンダリングを考慮した設計が特徴です。

拡張性

  • react-i18next:

    react-i18nextは、プラグインを通じて機能を拡張できるため、特定のニーズに応じたカスタマイズが可能です。例えば、バックエンドからの翻訳取得や、カスタムフォーマッタの追加が容易です。

  • react-intl:

    react-intlは、基本的な国際化機能を提供しますが、拡張性は限られています。シンプルなアプリケーションには適していますが、複雑な要件には不向きかもしれません。

  • react-intl-universal:

    react-intl-universalは、軽量でありながら、必要に応じて機能を追加できる柔軟性があります。特に、サーバーサイドレンダリングを必要とするプロジェクトに適しています。

学習曲線

  • react-i18next:

    react-i18nextは、豊富な機能を持ちながらも、ドキュメントが充実しているため、比較的学習しやすいです。特に、i18nextの知識があれば、すぐに使い始めることができます。

  • react-intl:

    react-intlは、シンプルなAPI設計により、初心者でも容易に理解できるため、学習曲線は緩やかです。特に、Reactに慣れている開発者には使いやすいです。

  • react-intl-universal:

    react-intl-universalは、シンプルな設定とAPIにより、迅速に習得できるため、特に新しいプロジェクトに適しています。

パフォーマンス

  • react-i18next:

    react-i18nextは、翻訳のキャッシュ機能があり、パフォーマンスを向上させることができます。特に、頻繁に翻訳を切り替えるアプリケーションで効果を発揮します。

  • react-intl:

    react-intlは、Intl APIを利用しているため、パフォーマンスは良好ですが、大規模なアプリケーションでは注意が必要です。特に、数多くのメッセージを扱う場合、最適化が求められます。

  • react-intl-universal:

    react-intl-universalは、軽量であるため、パフォーマンスに優れています。特に、サーバーサイドレンダリングを行う際に、迅速な応答が求められる場合に適しています。

選び方: react-i18next vs react-intl vs react-intl-universal

  • react-i18next:

    react-i18nextは、Reactアプリケーションに最適な国際化ライブラリです。特に、i18nextを基盤にしているため、豊富な機能と拡張性を持っています。複雑な翻訳やネストされた翻訳が必要な場合に適しています。

  • react-intl:

    react-intlは、国際化のためのシンプルで直感的なAPIを提供します。特に、日付や数値のフォーマットが重要なアプリケーションに適しています。Reactのコンポーネントとして簡単に統合できるため、学習コストが低いです。

  • react-intl-universal:

    react-intl-universalは、シンプルで軽量な国際化ライブラリで、特にサーバーサイドレンダリングをサポートしています。多様な環境での使用を考慮して設計されており、簡単に設定できるため、迅速な開発が可能です。

react-i18next のREADME

react-i18next Tweet

CI Coverage Status Quality npm

IMPORTANT:

Master Branch is the newest version using hooks (>= v10).

$ >=v10.0.0
npm i react-i18next

react-native: To use hooks within react-native, you must use react-native v0.59.0 or higher

For the legacy version please use the v9.x.x Branch

$ v9.0.10 (legacy)
npm i react-i18next@legacy

Documentation

The documentation is published on react.i18next.com and PR changes can be supplied here.

The general i18next documentation is published on www.i18next.com and PR changes can be supplied here.

What will my code look like?

Before: Your react code would have looked something like:

...
<div>Just simple content</div>
<div>
  Hello <strong title="this is your name">{name}</strong>, you have {count} unread message(s). <Link to="/msgs">Go to messages</Link>.
</div>
...

After: With the trans component just change it to:

...
<div>{t('simpleContent')}</div>
<Trans i18nKey="userMessagesUnread" count={count}>
  Hello <strong title={t('nameTitle')}>{{name}}</strong>, you have {{count}} unread message. <Link to="/msgs">Go to messages</Link>.
</Trans>
...

📖 What others say

Why i18next?

  • Simplicity: no need to change your webpack configuration or add additional babel transpilers, just use create-react-app and go.
  • Production ready we know there are more needs for production than just doing i18n on the clientside, so we offer wider support on serverside too (nodejs, php, ruby, .net, ...). Learn once - translate everywhere.
  • Beyond i18n comes with Locize bridging the gap between development and translations - covering the whole translation process. Now with a Free plan for your side projects!

ecosystem

Localization workflow

Want to learn more about how seamless your internationalization and translation process can be?

video

watch the video

Installation

Source can be loaded via npm or downloaded from this repo.

# npm package
$ npm install react-i18next
  • If you don't use a module loader it will be added to window.reactI18next

Do you like to read a more complete step by step tutorial?

Here you'll find a simple tutorial on how to best use react-i18next. Some basics of i18next and some cool possibilities on how to optimize your localization workflow.

Examples

v9 samples

Requirements

  • react >= 16.8.0
  • react-dom >= 16.8.0
  • react-native >= 0.59.0
  • i18next >= 10.0.0 (typescript users: >=17.0.9)

v9

Core Contributors

Thanks goes to these wonderful people (emoji key):


Jan Mühlemann

💻 💡 👀 📖 💬

Adriano Raiano

💻 💡 👀 📖 💬

Pedro Durek

💻 💡 👀 💬

Tiger Abrodi

💻 👀

This project follows the all-contributors specification. Contributions of any kind are welcome!


Gold Sponsors


localization as a service - Locize

Needing a translation management? Want to edit your translations with an InContext Editor? Use the original provided to you by the maintainers of i18next!

Now with a Free plan for small projects! Perfect for hobbyists or getting started.

Locize

By using Locize you directly support the future of i18next and react-i18next.