Questions tagged [babel-plugin-react-intl]

Extracts string messages from React components that use React Intl

Extracts string messages for translation from modules that use React Intl.

https://github.com/yahoo/babel-plugin-react-intl

23 questions
14
votes
3 answers

intl.formatMessage not working - react-intl

I am trying to do language translation using react-intl. When I use this , it is working perfect. But when I use the following code with intl.formatMessage(), it is not working and throwing some errors. I don't…
13
votes
3 answers

React-intl define messages outside of react

I have utils.js file. export function categoryIdToCategoryName(categoryId) { let name; switch (categoryId) { case constants.RISK_CATEGORY_LOW: name = 'low'; break; case constants.RISK_CATEGORY_MEDIUM: name =…
dfgd
  • 455
  • 1
  • 4
  • 20
10
votes
1 answer

Dynamically import language json file for react / react-intl

This is the way I configure my client to render the proper language through react-intl. import localeData from './translations/en.json'; //import localeData from './translations/xx.json'; <-- any language const render = routes => { match({…
Yen Sheng
  • 695
  • 1
  • 12
  • 28
4
votes
1 answer

Rendering a backslash from react-intl message when building with Webpack 1

Summary When I load my app using Webpack Dev Server, my messages show up fine: \. However when I bundle the application to disk and server the bundle via nginx, I see a duplication of my backslash: \\. Details I am using react-intl@2.2.3…
robert
  • 5,093
  • 2
  • 20
  • 21
3
votes
1 answer

Formatjs / react-intl with Vite

Formatjs provides a babel plugin for modules that use react-intl to inject message IDs and remove description. How can I use it with Vite?
Dheeraj Vepakomma
  • 26,870
  • 17
  • 81
  • 104
3
votes
1 answer

react-intl with server side rendering

Problem Next js SSR environment is failing to detect the locale for some languages like "gr" and "rs" or "es". I'm using react-intl https://github.com/formatjs/formatjs This is causing my browser to show this error on page load. utils.js:19 Error:…
user391986
  • 29,536
  • 39
  • 126
  • 205
2
votes
1 answer

IntlProvider not injecting ids on FormattedMessage

I'm following the guide here to setup automatic id generation for FormattedMessage components under the IntlProvider but it doesn't appear to be injecting the ids at run time since I'm receiving this error in the console. An `id` must be provided…
xzist
  • 45
  • 1
  • 1
  • 6
2
votes
0 answers

Casing of react-intl does not match the underlying filesystem

Current behavior import { FormattedMessage } from 'react-intl throws eslint error module "/node_modules/react-intl/lib/react-intl" Casing of react-intl does not match the underlying filesystem.eslint(import/no-unresolved) This wasn't…
Henry
  • 351
  • 3
  • 12
2
votes
1 answer

i18n message extraction in CRA using TypeScript

I'm trying to get i18n message extracted (defined by react-intl's defineMessages) to work properly in a CRA using TypeScript. I've got an existing react app bootstrapped by CRA with a couple of hundrets of lines of code. So rewriting the application…
2
votes
1 answer

"babel-plugin-react-intl" is not working as expected

I have created my react app using create-react-app command. Now I would like to available my website in both hindi and english language. So for that I am using yahoo/react-intl. I have also installed the babel-plugin-react-intl plugin. Also added…
Sourabh Banka
  • 1,080
  • 3
  • 24
  • 48
2
votes
1 answer

Use statically generates messages in React Intl

I have an object that contains content for a page, I import it and try to use it like you'd use any object variable: import {Variable} from 'data' const message = defineMessages({ message: { id: 'component.title', defaultMessage:…
2
votes
2 answers

How to add locale data dynamically using React Intl?

Am using React-intl for internationalization of an UI Util Library. The library has a folder say i18n wherein I place json files for different locales.If the user of this library want to add support for additional locales, he/she can place…
Santhosh
  • 534
  • 9
  • 24
1
vote
1 answer

React Intl, How to compile multiple language files in at a time?

According to Format.js docs, I can extract all messages from the source codes using flowing commands. yarn extract 'src/**/*.js*' --out-file lang/en.json --id-interpolation-pattern '[sha512:contenthash:base64:6]' It's working fine but when I go to…
Shifut Hossain
  • 1,599
  • 3
  • 14
  • 24
1
vote
1 answer

Webpack resolutions error with lodash and other modules

Using yarn to generate webpack build throws multiple module resolution errors on Mac OSX only. Using npm works fine. I believe the problem might be within webpack configuration to properly locate and load the modules. Run 'yarn run build' on Mac…
Arky
  • 380
  • 1
  • 4
  • 15
1
vote
0 answers

Cannot use react-intl-webpack-plugin with create-react-app

I want to use react-intl-webpack-plugin to combine messages from babel-plugin-react-intl into one message file. I have configured the webpack.config.dev.js, however, when I run "yarn start", I got the following error: Cannot read property…
1
2