Skip to content

Pass the correct script handle for translations#120

Merged
johngodley merged 1 commit intomasterfrom
fix/translations
Jul 24, 2020
Merged

Pass the correct script handle for translations#120
johngodley merged 1 commit intomasterfrom
fix/translations

Conversation

@dd32
Copy link
Copy Markdown
Member

@dd32 dd32 commented Jul 23, 2020

Fix translations by passing the script handle to wp_set_script_translations() rather than the block name.

In testing the Block Directory in non-english, I ran into these blocks not loading translations. Turned out it's passing the block slug rather than the script to localise.

@johngodley
Copy link
Copy Markdown
Member

The blocks are designed to be released individually, not as a 'block-experiments' bundle, and they must be packaged with the included script. This will ensure that the current wp_set_script_translations value is correct.

@dd32
Copy link
Copy Markdown
Member Author

dd32 commented Jul 24, 2020

You've misunderstood the PR.

The build process is not changing the first parameter to wp_set_script_translations(), which is intended on being the Script Handle, but is currently being passed a block slug.

This PR changes that parameter to the block-experiments literal that the build process seems to use to set the correct handle.

@johngodley
Copy link
Copy Markdown
Member

johngodley commented Jul 24, 2020

Alright, the reason for my confusion is that I had already added the correct translation call:

https://github.com/Automattic/block-experiments/blob/master/bundler/template/index.php#L44

But it was added somewhere else, and apparently without realising that there was an existing (incorrect) translation call added in #39. My change was unreleased so doesn't yet appear on wp.org.

I'll remove the one I added and go with the one here.

@johngodley johngodley merged commit bcd8508 into master Jul 24, 2020
@johngodley johngodley deleted the fix/translations branch July 24, 2020 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants