Skip Navigation

[Resolved] Images of repeating field not displayed correctly in WPML translations

This support ticket is created 6 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 8 replies, has 2 voices.

Last updated by Eric De Paep 6 years, 7 months ago.

Assisted by: Beda.

Author
Posts
#570056
repeating-images-issue.jpg

Hi,

I am displaying a repeating image field as a slider with this code:

<div id="slider" class="flexslider">
  <ul class="slides">
        [wpv-for-each field="wpcf-image"]
            <li>[types field="image" id="" size="large"][/types]</li>
        [/wpv-for-each]
  </ul>
</div>
<div id="carousel" class="flexslider">
  <ul class="slides">
        [wpv-for-each field="wpcf-image"]
            <li>[types field="image" id="" size="thumbnail"][/types]</li>
        [/wpv-for-each]
  </ul>
</div>

In my default language everything works great but the images in the 2 languages translated with WPML are not displayed correctly. The first image is repeated several times and, in some cases, the other images are not appearing at all (see attached screenshot ).

Thanks for your help.

#570092

I am preparing a whole WPML/Toolset local install to test this issue throughly.

It will require some time, I will update you by tomorrow the latest.

#570099

1. I created a Post Field of type image, and made it repeatable
2. I selected to copy this field over to translations
3. I created a Post with 3 Images
4. I translated that Post - it copies the images, as I set it
5. I created a View and displayed it like you do

It displays the same images in both languages.

I think you do not need to go the whole way of translating the media in this case.

The Field basically just holds an URL and can point to the original Image, I do not see why you would need to translate the image.

Could you let me know if this makes sense to you as well?

FYI:
I also made the test by translating the Images, and I got the same positive output.

Are there any more steps I need to follow?
Can you share an URL where I see the issue?

#570271

Hi Beda,

Yes, this makes sense to me. The only reason for translating the images, would be to have a different alt tag for each language. As far as I know I went through the same process as the one described in your reply and copied the field to translations. I also tried to translate them. But this doesn't change anything. By the way, I noticed that the alt tags are empty in all languages, even in the default language.

The only difference between your process and mine, is that you apparently published the view directly in a post. My content template is published in a custom post layout (layout for cars).

You can see the issue here when you login: hidden link (or when opening any other car in the stocklist in one of the translated languages: hidden link

Thanks

#571036

Hi Beda,

Did you have the opportunity to check this furhter?

Thanks

#571273
Bildschirmfoto 2017-09-19 um 09.49.54.png

I am sorry for the delay.

The Alt text needs to be added when you upload the Image and you can customize it when inserting the ShortCode - but in a Repeating Field, this will not help a lot.

You can store the Data for each image when you upload it, and then you can re-use it with these placeholders:
- %%TITLE%%
- %%ALT%%
- %%CAPTION%%
- %%DESCRIPTION%%

To translate it, you need to run the WPML Media Manager first, and then edit each Image (in the translation) and update (translate) it's Meta Data, this is correct.

Anyway, you did not create a View, you just inserted the Code in a Content Template.
I used a View. Not a Content Template. But that should not matter so far.

The reason you see only the same image all over is, in the Car edit Screen, you uploaded all those Images several times.
(see image)

Please delete them, and upload only the ones you want to see.
Then, if you want to translate Media Meta, you need to use WPML Media Translation process as you did, and display the Images with the ShortCodes
The translation will work on the front end, this is not the problem.

What I see missing is the ALT tag, but that is a different issue.
Also note that if you do not pass an ALT (I see none of images do have no ALT at all, in the edit screens) nothing will be displayed either.
If this issue persists after adjusting the setup, please open a new ticket with the missing ALT issues.

#571341

Hi Beda,

Yes, I knew about the way to translate the media but, as these cars are only for test purpose, I only translated some images for test purpose. Anyway, I noticed the ALT placeholder was missing in my repeating fields shortcode. Thanks for pointing that out.

Concerning the repeating image issue, I assure you that I did not upload them several times because I'm using the translation editor and this field is not translatable. In the translated version of one of my cars the first image has been copied 37 times. You can imagine I didn't spend my time uploading the same image 37 times. There must have been a bug when WPML copied the images to translations.

Luckily, I was able to delete the redondant images from the WordPress backend but I first had to set the repeating image field to 'Translate'.

I also made a new test creating a new car. The first time I saved the translations, the system only copied the first image. Then I added a new image and saved it again. This time all images were copied but the order in the translations is different and I can't change it if the field is set to 'Copy from original to translation'.

Thanks.

#571672

You cannot touch the translated fields, this is correct and expected.

You should translate them to reorder or edit.
Then, they are not any more "copies" and will not be locked anymore.

If there are some needs of enhancement here, it would be a topic to post in the WPML forums, as Types only provides the Data, it does not manage the translation.

It should thou, in my opinion, also copy over the order of those images.
Once again, this is not something I can solve for you, as it is a WPML issue in this particular case.

I apologise that for the remaining issues, I have to ask you if you could gently inform the WPML Supporter on this issue?

Thank you!

#571864

Hi,

OK, I will inform the WPML helpdesk about this.

You're right, Translate (or Copy Once) is the only solution for the moment as you should be able to reorder images after translation.

Thanks

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.