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

All the list item separators within text must be translatable #58265

Open
afercia opened this issue Jan 25, 2024 · 1 comment
Open

All the list item separators within text must be translatable #58265

afercia opened this issue Jan 25, 2024 · 1 comment
Labels
l10n Localization and translations best practices [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Jan 25, 2024

Description

Splitting this out from #58201 (comment)

While searching for join( ', ' through the codebase, it turned out that such a separator is used to delimit list items embedded in translatable strings. That approach may work for English and other Western languages but it's not okay. The list item separator needs to be translatable.

In WordPress core, the wp_get_list_item_separator() function internally applies a translation function and returns a separator string. See also WP_Locale->get_list_item_separator().

Gutenberg needs a similar approach where the list item separator and possibly in the future other separators, etc. are in a centralized location and can be reused throughout the codebase.

So far, in #58256 there is a proposal to add a l10n object to packages/editor/utils to provide a translation mechanism for the list item separator.

Whatever the final implementation will be, all the occurrences of a comma used as list item separator within the user interface text needs to be replaced with a translatable string.

Step-by-step reproduction instructions

N/A
Look for usage of such .join( ', ' ) pattern in the codebease e.g.:

<PanelRow>{ globalStylesChanges.join( ', ' ) }</PanelRow>

This example is used here in the Global Styles, when saving changes:

Screenshot 2024-01-26 at 12 11 05

Screenshots, screen recording, code snippet

No response

Environment info

No response

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

Yes

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

Yes

@afercia afercia added [Type] Bug An existing feature does not function as intended l10n Localization and translations best practices labels Jan 25, 2024
@afercia
Copy link
Contributor Author

afercia commented Jan 26, 2024

Update: #58256 tried to introduce a l10n utility object containing the translatable list item separator. It was hten decided to simplify the affected translatable string. The general issue is still valid though as there are other occurrences of non-translatable commas an the editor doesn't have a way to handles these cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
l10n Localization and translations best practices [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

1 participant