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

Simplify sprintf translation for percentage widths #68587

Merged

Conversation

im3dabasia
Copy link
Contributor

Related comment: #68270 (comment)
Related issues: #52787 , #66323 (review)

What?

This PR refines the code quality by simplifying the translation of percentage widths.

Why?

The previous implementation used __( '%1$d%%' ) due to an ESLint error being flagged when using the simpler __( '%d%%' ). Now that the sprintf regex has been updated, this simplification is possible without causing issues. The change ensures consistency across the codebase and improves readability.

How?

Replaced __( '%1$d%%' ) with __( '%d%%' ) for percentage translations.

Copy link

github-actions bot commented Jan 10, 2025

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: im3dabasia <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: Mamaduka <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@im3dabasia
Copy link
Contributor Author

im3dabasia commented Jan 10, 2025

Hey @t-hamano ,

When you have a moment, could you please review my PR? I'd appreciate your feedback.

I’m not sure why the linting checks for JavaScript are failing. The changes I made didn’t raise any linting errors during development.

@Mamaduka Mamaduka added [Type] Enhancement A suggestion for improvement. Internationalization (i18n) Issues or PRs related to internationalization efforts labels Jan 10, 2025
@Mamaduka
Copy link
Member

@im3dabasia, rebasing should fix the failing Static Analysis check.

@im3dabasia im3dabasia force-pushed the fix/simplify-translation-strings branch from fbe92d3 to 9a9fdf7 Compare January 10, 2025 10:20
@t-hamano t-hamano self-requested a review January 10, 2025 13:08
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice follow-up 👍

@t-hamano t-hamano self-requested a review January 10, 2025 14:17
@t-hamano t-hamano added the props-bot Adding this label triggers the Props Bot workflow for a PR. label Jan 10, 2025
@github-actions github-actions bot removed the props-bot Adding this label triggers the Props Bot workflow for a PR. label Jan 10, 2025
@t-hamano t-hamano merged commit d9e4df8 into WordPress:trunk Jan 10, 2025
69 checks passed
@github-actions github-actions bot added this to the Gutenberg 20.1 milestone Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internationalization (i18n) Issues or PRs related to internationalization efforts [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants