hjylewis / babel-plugin-inline-i18n-messages Goto Github PK
View Code? Open in Web Editor NEWA tooling-agnostic i18n message inlining plugin for babel
Home Page: https://npm.im/babel-plugin-inline-i18n-messages
License: MIT License
A tooling-agnostic i18n message inlining plugin for babel
Home Page: https://npm.im/babel-plugin-inline-i18n-messages
License: MIT License
Dependabot can't resolve your JavaScript dependency files.
As a result, Dependabot couldn't update your dependencies.
The error Dependabot encountered was:
Error whilst updating @formatjs/cli in /package-lock.json:
No matching version found for intl-messageformat-parser@^5.0.7.
If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.
I have a question regarding this repo? If i have 5 supported langugaes, then would there be 5 different js bundles or chunks created?
If a message is in all caps (e.g. "FAQ"
) or a message ID is in all caps/number (e.g. "404"
) the following error is thrown by Babel:
Error: @babel/template placeholder "FAQ": Expected string substitution
While changing message ID's to something else is not a problem, messages themselves shouldn't trigger such an error.
Is there a way to fix that?
Should the configuration accept functions instead of paths to modules?
Should we pick "file" or "source" for "addMessagesSource" etc? What about "path"?
Hi there!
What you are doing is amazing and you are solving a very big problem for apps that have a lot of strings. I'm really glad this exists now!
However, from the current examples it's not immediately obvious how this would work with isomorphic apps, using Next.js for example.
So if you could provide some pointers or maybe create a Next.js example, you'd save someone's life :)
Thanks!
This is not a problem with this library. I see that it is using @formatjs/cli
which is in turn using babel-plugin-react-intl
to extract keys for each page, and babel-plugin-react-intl
only extracts keys for defineMessages()
, defineMessage()
, and <FormattedMessage>
imported from react-int
and declared according to react-intl
's API.
However, many developers, myself included, find those declarations overly verbose and use something like
// translate.js
export default const t = (id) => ( <FormattedMessage id={id} /> )
and then elsewhere in code
// app.js
import t from "./translate"
...
<span>{t("hello")}</span>
And so those declarations don't get extracted.
So the question is - is there a way to extract such declarations?
It probably doesn't need to be that high
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.