question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migrate to JS-Lingui for i18n

See original GitHub issue

Issue

Description

JS-Lingui is a relative new library for internationalization, the API is very similar to React18next, in fact the author decided to do this in order to easily migrate from other libraries.

It supports plurals as well as custom formatting for texts. The most important thing is that this library comes with a CLI that we can use to manage the keys/text in all the different languages that we will support.

When it comes to manage the translations, it’s near impossible to find out which keys are unused/missing without an automated tool. JS-Lingui alleviates this pain, by providing a CLI that we can use in development.

Finally, this library adds a few KB to the final build which is great for performance!

Direct Requirements

  • Remove all i18next dependencies from package.json
  • Remove the i18next code from src/config/i18n.js
  • Setup JS-Lingui https://lingui.js.org/tutorials/react.html
  • Using the CLI add the two languages that we support (en, fr)
  • Migrate the existing translations in the components that we have

Indirect Requirements

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
crysfelcommented, Nov 28, 2018

@tricoder42 that was a typo that completely changed the meaning of my message 😅

We are now using Lingui

I think Lingui is awesome!

1reaction
crysfelcommented, Oct 2, 2018

Use the localeDir configuration to set the path to src/i18n, then webpack should be able to load the files.

https://lingui.js.org/ref/conf.html#localedir

Read more comments on GitHub >

github_iconTop Results From Across the Web

[next] Misleading migration guide regarding i18n.load ... - GitHub
Describe the bug I'm getting a TypeScript error when using the method i18n.load. Probably something in my messages catalog is wrong, ...
Read more >
Migration guide from 2.x to 3.x — LinguiJS documentation
NumberFormat and DateFormat components were removed. Import i18n from @lingui/core package and use i18n.date() and ì18n.number() instead.
Read more >
lingui/js-lingui - Gitter
Hi, I'm exploring using lingui for node and was wondering if there's a way to get a translation without having to activate the...
Read more >
Common i18n patterns in React — LinguiJS documentation
Using jsx macros is the most straightforward way how to translate your React components. <Trans> handles translations of messages including variables and other ......
Read more >
lingui-i18n - npm
Start using lingui-i18n in your project by running `npm i ... See the migration guide for more info. ... github.com/lingui/js-lingui ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found