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

Update percentage strings to be translatable #66323

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

AhmarZaidi
Copy link
Contributor

What?

Fixes: #66298

This PR makes percentage values such as "100%" translatable by replacing hardcoded percentage strings with placeholders.

Why?

"Different locales use different symbols for the percent sign. And like currency symbols, the percent sign can go to the left or right of its associated number depending on the locale." - ref: 1, 2

This means percentage values are not consistently translated across different languages when using hardcoded strings. This PR replaces those hardcoded values with translatable placeholders, allowing proper localization for all languages.

How?

Replaces hardcoded value such as { scale }% with wordpress/i18n's translation function (__) along with translators comment & sprintf.

Testing Instructions

N/A

Testing Instructions for Keyboard

N/A

Screenshots or screencast

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Oct 22, 2024
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @AhmarZaidi! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@AhmarZaidi AhmarZaidi marked this pull request as ready for review November 13, 2024 13:46
Copy link

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: AhmarZaidi <[email protected]>
Co-authored-by: t-hamano <[email protected]>

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

@t-hamano
Copy link
Contributor

Hi @AhmarZaidi,

All ButtonGroup components in the core blocks have been replaced with ToggleGroupControl, so we should be able to move this PR forward again.

Could you resolve the conflicts in this PR?

@t-hamano t-hamano added [Block] Buttons Affects the Buttons Block [Package] Block editor /packages/block-editor [Block] Search Affects the Search Block - used to display a search field l10n Localization and translations best practices [Type] Bug An existing feature does not function as intended labels Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Buttons Affects the Buttons Block [Block] Search Affects the Search Block - used to display a search field First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository l10n Localization and translations best practices [Package] Block editor /packages/block-editor [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

l10n: Make percentage values ​​translatable
2 participants