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

Link suggestion always displays post type in english #21377

Open
maximebj opened this issue Apr 3, 2020 · 2 comments
Open

Link suggestion always displays post type in english #21377

maximebj opened this issue Apr 3, 2020 · 2 comments
Labels
[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) Internationalization (i18n) Issues or PRs related to internationalization efforts [Type] Bug An existing feature does not function as intended

Comments

@maximebj
Copy link
Contributor

maximebj commented Apr 3, 2020

Hi!

The new link modal in WP5.4 is very neat!
I was missing the post type in the suggestions.

So, the issue is in the fact than the post type is always displayed in english : post, page...

post-type

I'm from France, the translation is complete so I don't think it's a missing translation (and those terms are on the core for decades). Maybe the slug is used instead of the real name?

@talldan talldan added Good First Issue An issue that's suitable for someone looking to contribute for the first time Internationalization (i18n) Issues or PRs related to internationalization efforts Needs Testing Needs further testing to be confirmed. and removed Good First Issue An issue that's suitable for someone looking to contribute for the first time labels Apr 7, 2020
@johngodley
Copy link
Contributor

Confirmed this by setting my site language to French, adding a link in a paragraph, and typing words from a post title.

As you surmised, the problem is because the request is returning a post type, not a display name. The post type is set here:

https://github.com/WordPress/WordPress/blob/master/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php#L25

This is then displayed as-is by https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/link-control/search-item.js#L55

I imagine the API should return a post type display name, or the link control changed to map between type and display name.

@johngodley johngodley removed the Needs Testing Needs further testing to be confirmed. label Apr 14, 2020
@jordesign jordesign added [Type] Bug An existing feature does not function as intended [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) labels Aug 16, 2023
@jordesign
Copy link
Contributor

Noting that this is still present in WP 6.3

petitphp added a commit to petitphp/gutenberg that referenced this issue Feb 2, 2024
…omponent (WordPress#21377)

- Add a new media search handler to standardize the response shape for all search request in the editor
- Add a new REST field `label` in the search-result schema. This field contains the localized post type name of each item in the response.
- Update `getVisualTypeName` function to use the new `label` field when displaying suggestions in `LinkControl`
petitphp added a commit to petitphp/gutenberg that referenced this issue Apr 15, 2024
…omponent (WordPress#21377)

- Add a new media search handler to standardize the response shape for all search request in the editor
- Add a new REST field `label` in the search-result schema. This field contains the localized post type name of each item in the response.
- Update `getVisualTypeName` function to use the new `label` field when displaying suggestions in `LinkControl`
petitphp added a commit to petitphp/gutenberg that referenced this issue May 17, 2024
…omponent (WordPress#21377)

- Add a new media search handler to standardize the response shape for all search request in the editor
- Add a new REST field `label` in the search-result schema. This field contains the localized post type name of each item in the response.
- Update `getVisualTypeName` function to use the new `label` field when displaying suggestions in `LinkControl`
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] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants