Skip to content
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

Define the textdomain correctly for block scaffold #123

Closed
grappler opened this issue Jan 30, 2018 · 6 comments
Closed

Define the textdomain correctly for block scaffold #123

grappler opened this issue Jan 30, 2018 · 6 comments

Comments

@grappler
Copy link

As mentioned in https://github.com/wp-cli/scaffold-command/pull/96/files#r164610714 the JS i18n functions do not except the second argument for the text domain. https://github.com/WordPress/gutenberg/blob/master/i18n/index.js#L42

There does not seem to be a way to define the text domain at the moment. WordPress/gutenberg#4147

@gitlost
Copy link
Contributor

gitlost commented Jan 30, 2018

Ta v much @grappler

From wp-cli/wp-cli#4512 (comment)

The temp solution today would be to remove the text domain. Once there is a correct way of adding the text domain that could be added in a future release...

Sounds good to me...

@schlessera schlessera modified the milestone: 1.1.2 Jan 30, 2018
@schlessera
Copy link
Member

This was already fixed in c74032f

@grappler
Copy link
Author

Oh, I must be doing something wrong. After running wp cli update --nightly today.
WP-CLI 1.5.0-alpha-d790e72

The command I ran wp scaffold block pdf-block-2 --title="PDF Block 2" --plugin=pdf-block-2 --dashicon=media-document

I get the following for block.js:

( function( wp ) {
	var el = wp.element.createElement;
	var __ = wp.i18n.__;

	// Visit https://wordpress.org/gutenberg/handbook/block-api/ to learn about Block API
	wp.blocks.registerBlockType( 'pdf-block-2/pdf-block-2', {
		title: __( 'PDF Block 2', 'pdf-block-2' ),

		icon: 'media-document',

		category: 'widgets',

		// Remove to make block editable in HTML mode.
		supportHTML: false,

		edit: function( props ) {
			return el(
				'p',
				{ className: props.className },
				__( 'Replace with your content!', 'pdf-block-2' )
			);
		},

		save: function() {
			return el(
				'p',
				{},
				__( 'Replace with your content!', 'pdf-block-2' )
			);
		}
	} );
} )(
	window.wp
);

@schlessera
Copy link
Member

@grappler Don't worry, we haven't pushed a release for the scaffold command that contains this change.

But when providing bug reports, you should always first check the latest state of the master branch, not the released packages: https://github.com/wp-cli/scaffold-command/blob/master/templates/block-block-js.mustache#L27

@grappler
Copy link
Author

OH, I get it now. Sorry for the not so useful bug report.

Thanks again!

@schlessera
Copy link
Member

No, thanks to you for bothering to submit one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants