Documentation

Magic Translate vs. react-intl

react-intl is part of FormatJS. It formats messages, dates and numbers with the ICU message syntax, and you supply the translations for each language. Magic Translate translates the text in your components directly, so you don't write or maintain any translations.

At a glance

Magic Translatereact-intl
How you write textYour own words, wrapped in <T><FormattedMessage> with an id and a default message
TranslationsMachine translation, created automaticallyYou extract messages and have them translated
Message filesNoneOne file per language
Dates and numbersUse the browser's Intl APIsBuilt-in components and ICU syntax
Server renderingReact Server Components and Next.jsYes, with extra setup
PriceFree plan, then monthly plans based on usageOpen source and free

How the code differs

With react-intl, each message has an id, and the translations live in separate files:

import { FormattedMessage } from 'react-intl';
const Welcome = () => (
<FormattedMessage id="home.welcome" defaultMessage="Welcome back!" />
);
// Then extract the messages, translate them for every language
// and load the right file when the app starts.

With Magic Translate, you write the message once:

import { T } from '@magic-translate/react';
const Welcome = () => <T>Welcome back!</T>;

When to choose Magic Translate

  • You want your app in many languages without a translation workflow.
  • Your texts change often, and you want every language to stay up to date.
  • You want new languages without paying for or waiting on translators.

When to choose react-intl

  • You need ICU message syntax for complex plurals and gender.
  • Your translations must be written or reviewed by people.
  • You want a free, open-source library with no external service.

Using both

The two work well together. Use react-intl or the Intl APIs to format dates, numbers and currencies, and Magic Translate to translate the text around them.

Ready to try it? Follow the getting started guide to translate your first component in five minutes.