Comments (3)
Could you try with the following .babelrc
?
{
"presets": [["babel-preset-gatsby"]],
"plugins": [
[
"react-intl",
{
"moduleSourceName": "gatsby-plugin-intl"
}
],
[
"react-intl-auto",
{
"moduleSourceName": "gatsby-plugin-intl"
}
]
]
}
With this, it works on my side. I think there's probably a bug somewhere that made the need for such a configuration, but I've been struggling to figure out what's going on.
from extract-react-intl-messages.
Thanks for you reply, For the record, this was my babel.config.js
:
module.exports = function (api) {
api.cache(true);
return {
presets: ["@babel/preset-react", "@babel/preset-typescript", "babel-preset-gatsby"]
}
};
Unfortunately following your suggestion, adding the plugins in babel config (also I had to install babel-plugin-react-intl-auto
), this did not solve the problem.
from extract-react-intl-messages.
Just to narrow down the problem a little, in my example from the first post, whether I use intl.formatMessage
or the JSX component FormattedMessage
doesn't matter, both:
import { useIntl, defineMessages } from "gatsby-plugin-intl";
const intl = useIntl();
const messages = defineMessages({
description: {
id: "about.description",
defaultMessage: "this description isn't picked up",
values: {
newline: <br />,
},
},
});
...
{intl.formatMessage(messages.description)}
and
import { FormattedMessage, defineMessages } from "gatsby-plugin-intl";
const messages = defineMessages({
description: {
id: "about.description",
defaultMessage: "this description isn't picked up",
values: {
newline: <br />,
},
},
});
...
<FormattedMessage {...messages.description} />
yield the same result: no description
field is created in translation's JSONs.
from extract-react-intl-messages.
Related Issues (20)
- defineMessage (singular) definitions not extracted HOT 1
- Add option to provide custom babel configuration. HOT 1
- Restore the `module-name` option HOT 1
- Versions after 2.2.1 deletes translation files content HOT 3
- How to avoid duplicate keys HOT 3
- babel-plugin-react-intl has been initialised using an options object that does not match the API schema HOT 6
- extractReactIntl named export is overwritten HOT 1
- How to use extract-react-intl-messages in react-native project ? HOT 1
- Feature: allow multiple default locales, for defaultMessage
- No output HOT 1
- Prettify output HOT 1
- Generated files are empty HOT 1
- Empty translation files if project uses babel.config.js instead of .babelrc HOT 4
- Extract-messages pattern HOT 1
- Tool does not export messages defined with intl.formatMessage HOT 2
- Getting an error for using FormattedHTMLMessage HOT 1
- Library is thinking that there might be an HTML tag in defaultMessage HOT 1
- Support __dirname as a part of the build directory
- Question : Support of moduleSourceName to accept detection from a different module ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extract-react-intl-messages.