1

I'm having a hard time to create a react library that supports translations. Let's say I have this structure

components
|- Button1
    |- Button1.tsx
    |- index.ts
|- Button2
    |- Button2.tsx
    |- index.ts
lang
|- en.json

what I want is, when my library is imported it already has translations. The problem is I need to add IntlProvider into each component. What's more I cannot use useIntl hook in the same component where I use IntlProvider. The only possible way is to add HOC to each component. Is there's a more slick way of doing that?

Petr Schukin
  • 170
  • 2
  • 12

1 Answers1

0

I got an answer on github. Basically the whole flow should be changed by using appropriate CLI commands from format.js (extract and compile).

Petr Schukin
  • 170
  • 2
  • 12