Skip to content

Commit

Permalink
Keep slug as a default text-domain for scaffolding create block
Browse files Browse the repository at this point in the history
  • Loading branch information
vampdroid committed Dec 12, 2024
1 parent f9fb57d commit 26961a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/create-block/lib/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ const category = {
const textdomain = {
type: 'input',
name: 'textdomain',
message: 'The text domain used to internationalize text in the block:',
message:
'The text domain used to internationalize text in the block (by default it will be same as slug):',
validate( input ) {
if ( ! /^[a-z][a-z0-9\-]*$/.test( input ) ) {
if ( input.length && ! /^[a-z][a-z0-9\-]*$/.test( input ) ) {
return 'Invalid text domain specified. Text domain can contain only lowercase alphanumeric characters or dashes, and start with a letter.';
}

Expand Down
2 changes: 1 addition & 1 deletion packages/create-block/lib/scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ module.exports = async (
customPackageJSON,
customBlockJSON,
example,
textdomain,
textdomain: textdomain || slug,
rootDirectory,
} );

Expand Down

0 comments on commit 26961a0

Please sign in to comment.