Skip to content

[5.x]: The alternative text field doesn't respect the translation method the first time it is entered #19052

@MoritzLost

Description

@MoritzLost

What happened?

Description

I noticed that the alternative text property on an asset volume doesn't respect the Alternative Text Translation Method the first time it is entered after uploading an image.

Steps to reproduce

  1. Create multiple sites with different languages
  2. Create a filesystem and an asset volume, add the alt property to the field layout and set the Alternative Text Translation Method to Translate for each language.
  3. Go to Assets and upload an image.
  4. Open the asset and enter something in the alternative text field, then save the asset.
  5. Check the asset in each site – the alternative text will have propagated to all of them, not just those with the same language.
  6. Delete the alternative text in one of the sites. This will respect the translation method, the other sites with different languages will still have the alternative text entered in step 4.
  7. Delete the alternative text from all sites, so the asset is in the same state it was after being uploaded.
  8. Enter an alternative language in one site again and save. Again, now the translation method is respected.

Expected behavior

The translation method should always be respected.

Actual behavior

I'm not sure if this is an intended behaviour or a bug. It looks to me like saving an asset for the first time is treated similar to creating an entry from a draft for the first time. I know that the initial propagation for an entry will always propagate all fields to all sites regardless of their translation methods. Looks like the behavior above is the same, but for assets?

However, that doesn't really make sense to me as a developer or as an author. Assets don't have the draft/live distinctions that entries have. After upload, the asset is available and can be accessed live (if it has a public URL). From an author's perspective, the asset is in the exact same state in steps 4 and 8 in the list above. There's no way to distinguish the two states, so there's no reason they should behave differently.

So regardless of whether this is intended or a bug, I think it should be saved. After the upload, the asset should be done with their initial propagation, and the translation methods should be respected.

Looks like the title also behaves differently. Haven't tested with custom fields yet.

Craft CMS version

5.10.5

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions