Skip to content

Alt text generation should generate text in the same locale of the Site Language setting #349

@afercia

Description

@afercia

Description

I quickly tested the alt text generation and noticed a few things that need improvements. I will try to create more issues but unfortunately I don't have much bandwidth to dedicate to this right now.

So far, to my understanding, alt text generation always generates text in English. That's less than ideal when the Site Language is other than English. By default, users would want any generated text to be in the language they chose.

As a sensible default, the generated text should be in the Site Language locale (to not be confused with the user locale).

There might be edge cases where the Site Language locale is in a certain language but editors would want to craft a post in a different language, e.g.:

  • The whole post content is in another language (because of reasons).
  • The post contains a section that is in another language, the section contains an image that might need a different language for the alt text.
  • More potential edge cases.

At the very least, the ability instructions should instruct the agent to use the language of the site locale. This would be a reasonable default behavior.

To cover edge cases, users should always have a way to override the default and set a language of their choice.
I'm not sure what the best way to override the default locale would be. I'd think that rather than providing a select to choose the language, a Traslate ability would fit better with the AI abilities paradigm.

Step-by-step reproduction instructions

  • In WP Admin > Settings > General, set the Site Language to a language other than English e.g. Italian.
  • In WP Admin > Users > Profile, keep the Language to 'Site Default'.
  • Create a post and add an image block with an image of a Pizza with pepperoni 🍕
  • Use the ability to generate the alt text.
  • Observe the generated alt text is in English.

Screenshot to illustrate the site language is in Italian (the user language is 'Site Default') however the generated alt text is in English.

Image

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 the AI plugin.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

Labels

[Type] BugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions