Plugin Author
Chouby
(@chouby)
Hi!
The ALT tag is not copied because it is expected to be translated.
Thanks for getting back to me. Still, that feels wrong to me: When I create a new language for an image, everything is copied, except ALT.
So why ‘caption’ and ‘description’ _is_ copied, when they usually are expected to be translated as well.
Similar with custom fields to attachments. Looking at the documentation of WPML, you can set these to “copy” or “translate”. Copy means they are always loaded from the original language, Translate means, well translate.
I any case, I find it better, more natural, to fill in copied language items as much as possible to
a/ help the translator with content and context
b/ have at least something to show, even if not translated yet.
Not a big deal anyway. I have added stuff to my translate_media() :
if($meta = get_post_meta($post_id, ‘_wp_attachment_image_alt’, true)) add_post_meta($tr_id, ‘_wp_attachment_image_alt’, $meta);
if($meta = get_post_meta($post_id, ‘_vu_image_tags’, true)) add_post_meta($tr_id, ‘_vu_image_tags’, $meta);
if($meta = get_post_meta($post_id, ‘_vu_product_sku’, true)) add_post_meta($tr_id, ‘_vu_product_sku’, $meta);
Plugin Author
Chouby
(@chouby)
Yes I agree. It lacks consistence. I will copy the alt text too.
Just downloaded the beta2 and saw it’s in already. Great!
Just out of pure curiosity: I see you trigger ‘pll_translate_media’ after having saved the translations. Not that I know anything about it, but doesn’t that mean that any changes from hooks are not saved?
Ultimately, that could be good or bad. I am just wondering.
Plugin Author
Chouby
(@chouby)
doesn’t that mean that any changes from hooks are not saved?
What do you mean exactly?
Sorry, I have been re-reading the code and I figure I got that wrong. I assumed that the hooks would possibly modify the $translation variable. But that’s clearly nonsense. Just drop that.