Magic Translate vs. Lingui
Lingui is an open-source i18n library for JavaScript and React. Like Magic Translate, it lets you write your own words in your components instead of keys. The difference is what happens next: with Lingui, you extract the messages, have them translated and compile them for every language. With Magic Translate, the translations are created for you.
At a glance
| Magic Translate | Lingui | |
|---|---|---|
| How you write text | Your own words, wrapped in <T> | Your own words, wrapped in <Trans> |
| Translations | AI translation, created automatically | You extract the messages and have them translated |
| Message files | None | One catalog per language, such as PO files |
| Build steps | None | Extract and compile the catalogs |
| New languages | Change the language setting | Translate every message into the new language |
| Plurals and formatting | Translated as part of the sentence | ICU messages with plural rules per language |
| Price | Free plan, then monthly plans based on usage | Open source and free |
How the code differs
With Lingui, the text stays in the component, but every message goes through a catalog:
import { Trans } from '@lingui/react/macro';const Cart = () => (<h2><Trans>Your shopping cart</Trans></h2>);// Then run `lingui extract`, translate the catalogs for every language,// run `lingui compile` and load the right catalog when the app starts.
With Magic Translate, the component looks almost the same, and there is nothing else to do:
import { T } from '@magic-translate/react';const Cart = () => (<h2><T>Your shopping cart</T></h2>);
When to choose Magic Translate
- You like writing your own words in your components, and you don't want to maintain catalogs.
- You don't have translators, or you don't want to wait for them before you release.
- You want new languages without a translation project.
When to choose Lingui
- Every text must be translated or reviewed by a person.
- You need ICU messages for complex plurals and gender.
- You want a free, open-source library with no external service.
Moving from Lingui to Magic Translate
Because both libraries keep the text in the component, moving is mostly a search and replace: <Trans> becomes <T>, and the t macro becomes the useT hook. You can move one component at a time.
Ready to try it? Follow the getting started guide to translate your first component in five minutes.