Thanks Fred,
I inspired from your plugin to make a new one that also translates the images using the function described in the original post above.
I updated the code to access Polylang with the new API in version 1.8 using:
PLL()->model->post->get_translation($image_id, $to_lang)
And now it also translates the image IDs in image galleries.
Lluis