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

Fix: experimentalUseColors: labels are not translatable #20112

Conversation

@jorgefilipecosta
Copy link
Member

jorgefilipecosta commented Feb 8, 2020

Description

Fix: #19890

The PR makes sure labels color labels of blocks using __experimentalUseColors are translatable.
The PR adds a label property that allows blocks to explicitly set a label.
It also has adds an object with the translatable labels for common color usages to allow blocks to have translatable color labels without the need to explicitly set them.
If no label is passed and no common label exists the old mechanism to generate labels is used.

How has this been tested?

I changed the COMMON_COLOR_LABELS to have random labels and verified the changes were applied.
I explicitly passed a label on the heading block text color and verified the label was used.

@epiqueras

This comment has been minimized.

Copy link
Contributor

epiqueras commented Feb 8, 2020

@jorgefilipecosta jorgefilipecosta force-pushed the fix/experimentalUseColors-labels-are-not-translatable branch from 4ad0435 to a803fb0 Feb 8, 2020
@jorgefilipecosta

This comment has been minimized.

Copy link
Member Author

jorgefilipecosta commented Feb 8, 2020

Can we follow the same approach taken with the other config variables where
we handle default values in the de-structure statement?

Hi @epiqueras, thank you for the review. The code was updated, let me know if you prefer this solution.

@epiqueras

This comment has been minimized.

Copy link
Contributor

epiqueras commented Feb 8, 2020

@jorgefilipecosta

This comment has been minimized.

Copy link
Member Author

jorgefilipecosta commented Feb 8, 2020

Why not just have it all in one line?

The formatting is being handled by prettier and the auto formation makes the code in multiple lines.

@epiqueras

This comment has been minimized.

Copy link
Contributor

epiqueras commented Feb 8, 2020

@jorgefilipecosta

This comment has been minimized.

Copy link
Member Author

jorgefilipecosta commented Feb 8, 2020

I mean panelLabel = x || y || z.

Wasn't that what the previous code I had (4ad0435) did?

panelLabel = colorConfig.label ||
					COMMON_COLOR_LABELS[ name ] ||
					startCase( name ), // E.g. 'Background Color'.
@epiqueras

This comment has been minimized.

Copy link
Contributor

epiqueras commented Feb 8, 2020

@jorgefilipecosta jorgefilipecosta force-pushed the fix/experimentalUseColors-labels-are-not-translatable branch from a803fb0 to 41941ae Feb 8, 2020
@jorgefilipecosta

This comment has been minimized.

Copy link
Member Author

jorgefilipecosta commented Feb 8, 2020

Yes, sorry about that. I’m on mobile and the strange formatting made it
look like it was outside the de-structure statement and later down in the
body.

No problem, thank you for the review 👍

@jorgefilipecosta jorgefilipecosta moved this from Needs Review to Approved in WordPress 5.4 Must Have Feb 8, 2020
@jorgefilipecosta jorgefilipecosta merged commit 4adaba2 into master Feb 8, 2020
2 checks passed
2 checks passed
pull-request-automation
Details
Travis CI - Pull Request Build Passed
Details
WordPress 5.4 Must Have automation moved this from Approved to Done Feb 8, 2020
@jorgefilipecosta jorgefilipecosta deleted the fix/experimentalUseColors-labels-are-not-translatable branch Feb 8, 2020
@github-actions github-actions bot added this to the Gutenberg 7.5 milestone Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.