This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 27 replies, has 2 voices.

Last updated by T4ng 2 months, 3 weeks ago.

Assigned support staff: Lauren.

Author Posts
May 15, 2019 at 1:25 pm #3817027

T4ng

When I translate images, the cranked wheel keeps spinning. When I update the page, I can't see the new image image the media translation page, though it's been uploaded: I can find it through the library.
Finally, if I update the image, with meta title and alt, from that library, I get it back through the media translation tool.

The media translation error comes with the following error log:

Got error 'PHP message: PHP Fatal error:
Uncaught TypeError:
Argument 2 passed to WCML_Update_Product_Gallery_Translation::get_translated_gallery()
must be an instance of WPML_Post_Element, null given, called in /plugins/woocommerce-multilingual/classes/media/class-wcml-update-product-gallery-translation.php
on line 37 and defined in /plugins/woocommerce-multilingual/classes/media/class-wcml-update-product-gallery-translation.php:49
Stack trace:
#0 /wp-content/plugins/woocommerce-multilingual/classes/media/class-wcml-update-product-gallery-translation.php(37): WCML_Update_Product_Gallery_Translation->get_translated_gallery(18750, NULL)
#1 /wp-includes/class-wp-hook.php(286): WCML_Update_Product_Gallery_Translation->update_meta(18751, Array, 'en')
#2 /wp-includes/class-wp-hook.php(310): W...\n', referer: {...}/wp-admin/admin.php?page=wpml-media

May 16, 2019 at 5:48 pm #3828523

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

To best troubleshoot the issue, please make a snapshot of your site using the Duplicator plugin: https://wordpress.org/plugins/duplicator/. This will allow me to try and duplicate the error so that I can run further tests without interrupting your live site.

Once the snapshot is complete, either upload the snapshot ZIP file and the installer.php file to a file sharing service such as Dropbox (and share the link in your reply) or right click the Duplicator links in your wp-admin and paste in your reply.

Please note: It is important to reduce the size of the package so please exclude some paths like /cache or /uploads and also exclude archives and media files.

I will also need the username and password of an account that was created BEFORE creating the duplicator package.

I will enable the next reply to be private so only you and I have access to it!

May 17, 2019 at 11:43 am #3834129

T4ng

Hi Lauren,

That's quite a process, and I'm not so keen to provide all of our website's code and plugins.

However... I since ran some further tests on our test environment (so without CloudFront).

I appears that, I actually had randomly both errors:
- The bug described above, with the WCML php fatal error
- and if not... the broken translation issue (when the image get properly uploaded, it breaks the translated page's content back to to the original translation, even if translated independently)

Therefore, both problems aren't related to the CDN.

Next step: if I de-activate W3TC, I don't get anymore trouble uploading my images (bug described here). The problem is not permanent with W3TC, but it seems it make it happen from time to time. There might be something to fix with admin cache, I'll have a look into this.

However, I got my broken content page content backn on a very consistent basis now.

Therefore... I did some more test, with a single image and a single text (already translated through media translation), and think I nailed it.

First test
1. I built a page in french: french copy + the image
2. Translated the page through classic editor (copy) > Everything is fine, the content and image get translated (whenever I don't get anything asked about that image - weird but... whatever)
3. Removed the image translation from media translastion > Image moves back to the original one, translated copy stays
4. Once again, added an image translation > I get it back in the page, and keep my translated copy.

Second test
1. I built a page in french: french copy + the image
2. Translated it *independently* (basically the copy) : I can adjust my copy, and get the translated image as soon as the page is created
3. I remove the image translation from media translation > I get the original image... and copy back.

My conclusion the problem is that whatever the process, there is just no possibility using the media translation without using the classic translation process. Period.

That means unless we have parallel content structure across languages, we can't use media translation, because as soon as we'll update a page related media state, it's gonna bring back the content to its last state from the classic translation editor.

That's quite la limitation because it means we can't neither have language specific content structure, nor hide/show specific blocks for a language, while still translate the medias across media translation. We just have to upload our medias individually, and can't take advantage of media translation to keep our medias library clean and tidied up.

Please tell me if I'm wrong.

May 17, 2019 at 2:34 pm #3835275

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

In regards to "we can't neither have language specific content structure, nor hide/show specific blocks for a language, "

This is not possible when using the Translation Editor, so you will need to use manual translation. This is because when you use the Translation Editor, the layout will match the original page. There is no option in Translation Editor to display blocks for some languages but not for others.

So, if that is what needs to happen for your site, then you will need to stick with manual translation, because what you are experiencing currently with the classic editor is expected behavior. Did I understand that correctly?

May 17, 2019 at 2:48 pm #3835311

T4ng

Yep, we found a solution in Elementor by setting _elementor_data to "Copy Once", that allows us to edit our content individually and keep different layouts.

Still, as soon as we translate an image from the media translation, the original content will popup in every language, event if the page has never been translated from the classic editor.

Is there a way to use the media translation without the Classic translation editor? At least, if not able to keep track of pages that don't keep the exact same layout or elements, WPML would still help us managing our medias across languages.

Finally, now I'm thinking of how I'm gonna take care of my content that I took ages to update to use the media translation: if I use the media translation again to add an image translation for a new language, I will have to take care of every single translation of a page again ?!

May 17, 2019 at 3:40 pm #3835779

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

I just tested this on a fresh install and have no problem using media translation with the native WordPress page editor. Here are the steps I took.

1. Upload an image to the media library
2. Create a page and insert the image into the page
3. Translate the page manually and save. The original image shows on the translated page.
4. Go to WPML -> Media Translation and add a different image for the second language.
5. When I reload the page, the new different image shows for the translation, and the original image shows for the default language.

Feel free to play around in this staging site, you can make any changes you would like. Please let me know if you are able to reproduce the issue here:
Login: hidden link
Username: demo
Password: H61A8S6usSdj

May 17, 2019 at 4:21 pm #3835979

T4ng

Lauren,

When you say translate the page manually, I understand disable the Classic Translation Editor, Overwrite with (original) content (to get the image), then adjust my text content.

I did the test on your environment, everything works as expected.

Then I did it on our environment, with an image and some text in the page, everything works as well, besides image translation never inherit the alt (with or without a new image).

However, with Elementor, it doesn't work on an individually edited page: as soon a I update the image, the translated title stays, not the page content.
The image gets updated, and the rest of the page (text for example) get back to the original state.

May 17, 2019 at 6:44 pm #3836563

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

I installed Elementor Pro and ran a few tests. Both had expected behavior when translating with manual translation.

Page 1:
1. Create an English page with Elementor. Upload an image that was previously translated to the page.
2. Translate the page. The correctly translated image shows on the translation.

Page 2:
1. Create a new English page. Upload a new image that is not in the Media Library.
2. Translate the page. Remove the image and replace it with a different image via the WordPress page editor.
3. Both pages display correctly with separate images.

Can you please outline the steps you are taking when you are seeing the incorrect image?

May 18, 2019 at 5:02 pm #3839387

T4ng

Hi Lauren, thanks for testing, but my case is a bit different.

I just did it on your test website and face the same issue.

1. Create a new English page with an image that's already in the media library, already translated. I also add a text in my page
2. Duplicate the page > The translated image appears in the translated page. Then I edit it independently, and translate the text in the page.
3. Remove the image translation from media transation > The image is back to the original one in the page (that's fine)... But the text as well.

May 20, 2019 at 1:13 pm #3847195

T4ng

Hi Lauren,

Just did a new test on your platform.

1. Create an English page with Elementor. Upload a new image that is not in the Media Library, and add a text in an Elementor block.
2. Duplicate the page, adjust the title, and the text
3. Edit the alt of the spanish translations' image. > Everything's fine: my content in the spanish page is still translated (title, image, text)
4. I add a new image translation from the media tranlation > My spanish title is still translated, the image is, but the text is back to original.

May 20, 2019 at 5:37 pm #3849405

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Thanks so much for outlining the steps. I was able to reproduce it on the test site that I set up. I have escalated this to our compatibility team so that they can dig a bit deeper. I will update here as soon as I have more information.

May 21, 2019 at 8:32 am #3853235

T4ng

Lauren,
Another information that might help you. I just noticed that, if removing/replacing an image translation through the library breaks the page, using enable media replace from the media library to replace it won't break translation.
Can't test it on your test platform though, as Enable Media Replace's not installed

May 22, 2019 at 7:27 pm #3868885

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Thanks for the update. I am still working with the developers on this. They were not able to reproduce it with our latest dev version, so we are still checking a few things. I'll update as soon as I know more. Thanks for your continued patience.

May 23, 2019 at 8:00 am #3872233

T4ng

OK thanks for your involvement, but did you guys had a fix on tracks about such kind of issues? Because I don't think this is related to your last release.

May 23, 2019 at 12:22 pm #3874945

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

They are actually testing with the dev version which has not been released. I don't currently have any other reports of this happening, but I was able to reproduce it on the fresh install, so our compatibility team is investigating this issue with the developers to find a fix.