-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add text domain option while scaffolding the block in create-block #57197
base: trunk
Are you sure you want to change the base?
Add text domain option while scaffolding the block in create-block #57197
Conversation
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @vampdroid! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
@vampdroid thanks for putting this together! Would you be able to address the merge conflicts and update the branch with the latest from trunk? |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be mistaken, but it looks like this only covers interactive mode. It would be great to also have a --text-domain
flag that can be used to pass the text-domain when in quick mode.
@@ -153,6 +153,7 @@ program | |||
'description', | |||
'dashicon', | |||
'category', | |||
'textdomain', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you anticipate using different textdomain
values for individual blocks, or should it be a setting for the plugin? I can see how this could be useful only when scaffolding a block without a plugin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So currently this is applied to the block if used with --no-plugin
flag and to both if this flag isn't passed.
The solution would be to offer another prompt that shows up in the plugin section in the regular flow, but also when creating a block without a plugin.
I think this should be the ideal scenario right?
packages/create-block/lib/prompts.js
Outdated
const textdomain = { | ||
type: 'input', | ||
name: 'textdomain', | ||
message: 'The text domain used to internationalize text in the block:', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, the question is whether this setting should apply primarily to the plugin or block.
I added the |
Sure @gziolo, I will be updating the PR as soon as possible. |
What?
Issue - #54980
Why?
create-block
command to addtext domain
option in the scaffolding block's block.json metadataHow?
npx @wordpress/create-block --no-plugin
it adds 'textdomain' prompts where the user can specify the text domain for that block.--no-plugin
option. This way it will be shown both with the plugin and no plugin option.Testing Instructions
wp-content/plugins
npx ../gutenberg/packages/create-block --no-plugin
. (Make sure you already have the Gutenberg plugin installed and updated with this branch code in plugins folder already)The text domain used to internationalize text in the block:
after selecting a category where you can specify your text-domain.block.json
of your block folderTesting Instructions for Keyboard
None
Screenshots or screencast