WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.54k stars 4.21k forks source link

l10n: Make percentage values ​​translatable #66298

Open t-hamano opened 1 month ago

t-hamano commented 1 month ago

Description

Found this in the comment: https://github.com/WordPress/gutenberg/pull/65386#discussion_r1804243435

Percentage values ​​such as "100%" are not necessarily translated as "100%" depending on the language.

But in some places, these strings are hardcoded and cannot be translated.

I think we should make them translatable by using placeholders, like this:

/* translators: Percentage value. */
sprintf(
    __( '%s%' ),
    percentage
)

Here are the codes I found.

[!NOTE] Note that in each code, a ButtonGroup component is being replaced with a ToggleGroupControl component. After all these PRs are merged, it would be a good idea to localize all of the following in one PR.

ImageSizeControls component

https://github.com/WordPress/gutenberg/pull/65386

https://github.com/WordPress/gutenberg/blob/484c96035f521ff519afe7986c2199536a1e1485/packages/block-editor/src/components/image-size-control/index.js#L102

Search block

https://github.com/WordPress/gutenberg/pull/65340/

https://github.com/WordPress/gutenberg/blob/484c96035f521ff519afe7986c2199536a1e1485/packages/block-library/src/search/edit.js#L470

Button block

⚒️ https://github.com/WordPress/gutenberg/pull/65346

https://github.com/WordPress/gutenberg/blob/484c96035f521ff519afe7986c2199536a1e1485/packages/block-library/src/button/edit.js#L140

Step-by-step reproduction instructions

N/A

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Please confirm that you have tested with all plugins deactivated except Gutenberg.

AhmarZaidi commented 1 month ago

Hey 👋, I'd like to work on this issue.

AhmarZaidi commented 1 week ago

Raised a PR for this: https://github.com/WordPress/gutenberg/pull/66323