Skip to content

Conversation

@Adi-ty
Copy link
Contributor

@Adi-ty Adi-ty commented Sep 4, 2025

What?

Closes #71492

Localizes the labels shown in link control search items by fixing the getVisualTypeName() function to use proper translatable strings instead of raw post type slugs.

Why?

The link control search items were showing raw post type slugs that weren't translatable. Inconsistent capitalization handled via CSS transforms

How?

Added __() translation functions for all user-facing strings

@Adi-ty Adi-ty marked this pull request as ready for review September 5, 2025 12:30
@Adi-ty Adi-ty requested a review from getdave as a code owner September 5, 2025 12:30
@github-actions
Copy link

github-actions bot commented Sep 5, 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: Adi-ty <[email protected]>
Co-authored-by: getdave <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: dannyreaktiv <[email protected]>

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

Copy link
Contributor

@getdave getdave left a comment

Choose a reason for hiding this comment

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

Thank you for the PR. Very much appreciated.

Could we avoid changing the case of the labels in this PR? If we want to do that we can propose in a followup but it seems unrelated to the translation.

@getdave getdave added [Type] Enhancement A suggestion for improvement. Internationalization (i18n) Issues or PRs related to internationalization efforts [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) labels Sep 5, 2025
@t-hamano
Copy link
Contributor

t-hamano commented Sep 6, 2025

Could we avoid changing the case of the labels in this PR?

Since we removed the text-transform: capitalize, shouldn't all the labels be capitalized?

@Adi-ty Adi-ty requested a review from t-hamano September 6, 2025 18:29
Copy link
Contributor

@getdave getdave left a comment

Choose a reason for hiding this comment

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

Thanks for working on this 👍

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! We can't test it now, but once the Gutenberg plugin that includes this PR is released and each label is translated, the UI should also be localized.

Image

@t-hamano t-hamano merged commit c4d5fa4 into WordPress:trunk Sep 10, 2025
76 of 77 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.7 milestone Sep 10, 2025
talldan pushed a commit that referenced this pull request Sep 10, 2025
…71503)

* Localize labels in getVisualTypeName() for link control search items

Fixes #71492

* Update LinkControl tests to expect localized post type labels

* Ensure localized lowercase labels in getVisualTypeName

* Refactor LinkControl to use unified TYPES object for icons and labels

* Capitalize labels in TYPES object and test

Co-authored-by: Adi-ty <[email protected]>
Co-authored-by: getdave <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: dannyreaktiv <[email protected]>
adamsilverstein pushed a commit to adamsilverstein/gutenberg that referenced this pull request Sep 11, 2025
…ordPress#71503)

* Localize labels in getVisualTypeName() for link control search items

Fixes WordPress#71492

* Update LinkControl tests to expect localized post type labels

* Ensure localized lowercase labels in getVisualTypeName

* Refactor LinkControl to use unified TYPES object for icons and labels

* Capitalize labels in TYPES object and test

Co-authored-by: Adi-ty <[email protected]>
Co-authored-by: getdave <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: dannyreaktiv <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) 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.

Use labels in getVisualTypeName()

3 participants