Replace inline JSON Babel plugin with a custom version which supports i18n #15169
Labels
[Feature] Block API
API that allows to express the block paradigm.
[Feature] Block Directory
Related to the Block Directory, a repository of block plugins
Internationalization (i18n)
Issues or PRs related to internationalization efforts
[Status] In Progress
Tracking issues with work in progress
[Type] Build Tooling
Issues or PRs related to build tooling
[Type] Task
Issues or PRs that have been broken down into an individual action to take
This issue is part of the requirements for Block Registration API RFC (#13693).
One of the aspects that needs to be covered is internationalization. This is what RFC proposes as of today for JavaScript:
To get us there, we will need a custom Babel plugin which will inline imported JSON file and wrap translatable properties with the
_x
function as shown in the example above. Also, this plugin will have to ensure that the function mentioned above is available (imported) in the scope. To make it simpler for start, let's assume thattextdomain
is provided as another property inblock.json
file.As of today, we use
babel-plugin-inline-json-import
which was integrated as an intermediate solution in #14551:gutenberg/babel.config.js
Line 6 in 30d3328
It isn't clear whether we can build new functionality on top of it or rather we have to duplicate its logic and apply our own modifications in the cloned plugin. It needs to be investigated first.
The text was updated successfully, but these errors were encountered: