Skip Navigation
52

Media Translation now serves the same attachments for translations, instead of creating duplicates. This means that images appear “automatically” in translations, but with their meta-texts from the originals.

Before WPML 4.0, Media Translation would create duplicates for images for different languages. Since WPML already has a translation mode which allows serving the originals if translations are missing, the new Media Translation now uses that mode and doesn’t need to duplicate images.

Synchronizing Featured Images and Galleries

Featured images and image galleries work on translated content, without any duplicate images. It reduces clutter in your sites and makes it easier to keep media in sync between languages.

Your image galleries will automatically be displayed on translated content, so there is no additional setting or action you need to take.

The controls for synchronizing the featured image have moved from the Media Translation plugin to WPML Core.

Featured Image sync controls on the WPML -> Settings page Featured Image sync Controls on the post editing page

Translating Image Alt, Title, and Caption

To set different meta-texts (alt, title, and description), use the WPML Media Translation plugin. Go to WPML -> Media Translation, click on any image and enter replacement texts.

Translating Image Texts
Translating Image Texts

The New Purpose of Media Translation

As we moved most of the logic from Media Translation to WPML Core, the main purpose of Media Translation is to allow to choose replacement images when you’re translating with WPML’s Translation Management. Now (which didn’t exist before), you can choose different images to include in translations. Previously, you could only do this via the post-editor and your edits would be lost whenever translations are updated via Translation Management. We explain this workflow in the updated Media Translation documentation.

Update to WPML 4.0.3 and Media Translation 2.3.3

This change is now available in WPML 4.0.3 and Media Translation 2.3.3.

You will receive automatic updates via WordPress for all registered sites. To update manually, log-in to your WPML account, go to Downloads and get the new version from there.

Feedback?

This is a change in functionality compared to previous versions of WPML. We hope that it’s not causing any side effects with themes and plugins. If you notice something that used to work before and is not working for you now, please leave your comments and we’ll get back to you.

We appreciate very much all the feedback that we received for our previous post about Media Translation issues. This release addresses the reported issues. We pushed quickly so that images work again on translated content.

Looking forward to your feedback!

52 Responses to “Important changes in how Media Translation works since WPML 4.0”

  1. Hi Amir

    1. If I only have one version of the image that includes alt tags etc with English and Swedish texts, should I disable Media Translation?

    2. Will 4.0 delete the duplicates since I don’t use them?

    Thanks

    • If you don’t need to translate the image meta texts, you no longer need the Media Translation plugin.

      We don’t auto-delete the duplicate images, because this could harm existing sites. We created a documentation page that explains how to delete these duplicates via MySQL:
      https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-on-pages-in-secondary-languages/deleting-duplicate-content-after-changing-how-content-is-translated/

      • Tried to run this query but it is showing me an SQL Syntaxis error which I can’t find.

        Query where fcsp is my table prefix:
        DELETE FROM fcsp_posts
        WHERE post_type = ‘product’ AND ID IN (
          SELECT pm.post_id
          FROM fcsp_postmeta pm
            JOIN fcsp_icl_translations t ON t.element_id = pm.meta_value
          WHERE pm.meta_key = ‘_icl_lang_duplicate_of’ AND pm.meta_value > 0 AND
            t.element_type LIKE ‘post_%’ AND t.language_code = ‘en’
        )

        The error is:
        #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘pm.post_id
        FROM fcsp_postmeta pm
        JOIN fcsp_icl_translations t ON t’ at line 3

        Please elaborate more.

        • Hi Adri,

          I would try changing the quotes from ´ to ‘ and let me know if that resolves it for you.

          • Sadly that didn’t help. Changing them from ‘ to ‘ (and vice versa for that matter) is throwing me the same syntaxis error. Any ideas?

            • Hi Adri,

              I tested on a local site and the following worked. Please keep in mind I changed the db prefix and the forum changes the single quotes to curly quotes.

              DELETE FROM wp_posts
              WHERE post_type = 'product' AND ID IN (
              SELECT pm.post_id
              FROM wp_postmeta pm
              JOIN wp_icl_translations t ON t.element_id = pm.meta_value
              WHERE pm.meta_key = 'icl_lang_duplicate_of' AND pm.meta_value > 0 AND
              t.element_type LIKE 'post%' AND t.language_code = 'en'
              )

              I think it will be best to open a support ticket so that we can further troubleshoot and get more information for your site. You can create a duplicator package of your site and include the links when you open the ticket so that we can duplicate the issue locally, and then hopefully find a quick solution for you.

              Thanks,
              Lauren

              • Hi Lauren,
                Tis is my last message here. If needed I will post a support question. But here are my findings.

                No syntax errors this time, thew query was running. However it tells me that 0 rows are affected. Next to that I only see one version of the images in the library.

                I do see English and Dutch entries in WPML -> Media Translations.

                Did the query work or do I have to post a support question?

                HTH

                • Hi,

                  There might be a solution for that, but let’s move this to a support ticket please, that way we can grab a duplicate of your site and help, knowing we are not breaking anything,

                  Please open a ticket and paste here the link for it so I can follow,

                  Thanks!
                  Amit

  2. How do we pull translated images from featured images using get_the_post_thumbnail_url()? I have a post where I’m using an image that has alternate images for each language, but pulling it using get_the_post_thumbnail_url() is only giving me the English version. Thanks.

    • Hi Chuck,

      We may need to dig a bit deeper to figure out what is going on here. Please open a support ticket so that a supporter can address these issues and try to reproduce the error. Thanks!

      Lauren

    • Hi Chuck,

      I WPML 4.0.3, the option to display the featured image as translated was introduced. So if you enabled this for a post, when you call get_the_post_thumbnail_url() on one of its translations, the url of the featured image of the original post will be returned.
      But only if the attachment post to which the image belongs too is not translated.

      From what you said, I understand that the attachment is translated and a separate image is used for each translation.

      In this case, get_the_post_thumbnail_url() should return the ‘translated’ image. If it doesn’t, it means that either the attachment is not really translated or there’s a bug somewhere in which case you should report it to our support.

      However, we are removing this functionality of displaying the featured image as translated so this possible bug might have already been handled. You can keep an eye out for a beta version and test it on a development or staging site.

  3. Hi, I do translations manually, but I have no option to sync featured images. Is it normal?

    • Hi Michele,

      If you are using the latest versions of each WPML plugin and still not seeing the checkbox at WPML -> Settings, please open a support ticket so that a supporter can address this issue for you. You can make a Duplicator package of your site and share the links in your ticket so that we can test this locally for you.

      Thanks,
      Lauren

  4. With the new version, no images are attached to the translated posts. The theme in use needs the images to be attached to the translated posts in order to show these images in a gallery slider. How can this functionality be restored? Double upload doesn’t work for our client. In this case we need duplicates back.

    • Hi Sebastian,

      You can “translate” the image and just upload the same image for the translated post. Or is that what you mean by “double upload doesn’t work for our client”? The option for duplicating images will not be available. Please let me know if this resolves the issue for you.

      Thanks,
      Lauren

    • I’m having the same issue. After you translate an image, the translated image is not attached to the translated page. So of course if an image is not attached to a page, you lose the URL slug from the attached post when viewing its attachment page.

  5. I dont understand if i can disable media translator, on a new installation, witouot image loaded jet.

      • Hi Nadia, I just replied to your earlier comment. Let me know if there is more I can do to help.

        Thanks,
        Lauren

    • Hi Nadia,

      I’m not sure I understand your question. You want to disable media translation all together? Please feel free to reply here with more information, and I’ll be happy to assist you further.

      Thanks,
      Lauren

      • Thanks, if the Media Translation functionality are moved in the core of wpml, the wpml extension Media Translation is needed too? If i can translate the images witout that extension i can disable it?

        • Hi Nadia,

          If you want to be able to translate image meta, such as description, title, alt text, etc, you will need to use the Media Translation add-on.

          Thanks,
          Lauren

          • Thx, and sorry I do not understand completely: so why showing the notification below in the WordPress dashboard, when you do need to use the plugin when you want to translate image meta info? This confuses me as a layman user.

            “WPML Media does not need to be active for your site!

            WPML Media is no longer intended to be used without WPML Translation Management. As of WPML 4.0, attachments no longer need to be duplicated in order to show up in all languages. It is strongly recommended to deactivate WPML Media.

            Deactivate WPML Media”

            FYI: I haven’t installed “Translation Management”

            Thx for your attention.

            • We’re making some important changes (yet again) to Translation Management. These will go out on Monday. Can you hold off with this until then and see if everything is resolved and clear?

              • Thx Amir, no worries,
                “Rivers know this: there is no hurry. We shall get there some day.”
                ― A.A. Milne, Winnie-the-Pooh

  6. I like what you’ve done. It simplifies work on sites with lots of images with translated metadata (captions) in each lang.

    One thing I would like to see is a FORWARD and BACK button on the Media Translation screen when I am editing the metadata to move to the previous or next image (the same as exists in the default WP media library).

    That way, I could edit metadata on all images much more quickly without having to go back to the media overview page.

    Keep up the good work!

    • Hi Mike,

      Thanks for your kind words and also for the suggestion. I’ll pass this along to the development team as a feature request.

      Thanks,
      Lauren

  7. This is great news! Thank you for this update, I’ll be testing shortly.. this could fix a major issue I’ve been dealing with.

    What happens to all the duplicate content? Will WPML delete it automatically? Or does it just leave it there and only new content is affected?

    If that is the case (as I suspect), is there a way to delete old content while retaining the original image? (i have one site that has 13 languages and daily posts with images for the past few years, so there is a LOT of duplicated images that have been frustrating our team…

    • Hi Gabriel,

      Images that were previously duplicated should now display as “translated”, with the same image being used for both languages. Once you run the media installer, you will be able to view images per language using the admin language switcher, and you can bulk delete images from your secondary language(s) from the media library. I hope this helps! Let me know if you have any other questions and I’ll be happy to help.

      Thanks,
      Lauren

  8. Hi,

    in WPML > Media Translation from the WPML 4.0 update I see the following message:

    Installation is required

    To ensure the full functionality of WPML Media Translation, you must perform this installation that will take only a few minutes depending on the total number of articles expected from the WordPress installation.

    If I press Complete the installation button after the installation progress I still see the same message.

    • Hey there,

      As I wrote in the email I sent you, we haven’t had another report of such an issue so we will need more details in order to resolve this.

      Thanks,
      Dimitris

  9. Can I remove the duplicate media using from the library?
    Is I remember it correctly there was a link some where to a post how to do it in mySQL. If so can you provide me the link? I can’t find it anymore.

  10. Hi team!
    Media Translation 2.3.3 will not accept HTML tags (e.g. a simple line break) in image captions, though they work in the original media. Translated caption gets stripped. Is that on purpose?
    Any workaround?

    Thanks,
    Nadja

    • Hi Nadja,

      You can use HTML tags if you edit the caption in the Media Library. Click on the Media link in your dashboard and then use the admin language switcher at the top of your dashboard to switch to the secondary language. From there, click on the image you would like to edit and you can add the HTML tags here. I hope this helps – let me know if there is anything else I can assist with.

      Thanks,
      Lauren

  11. Now, we wil have to first upload images and go to media translation to do translate metas and after that create a post and choose the translated image?

    • Hi Faith,

      You can translate the image meta directly from the Translation Editor. You should see fields for image Title, Caption, Alt Text and Description.

      Thanks,
      Lauren

  12. Just the feature I was waiting for, thanks guys.
    But for custom post types (portfolio for example) feature image duplication doesn’t seem to work. It actually works for posts and pages but not for custom post types.
    How can I make it work?

    Thanks.

  13. Thanks guys it was just a feature I was waiting for.

    Is it working for the custom post types as well?
    Because I notice it actually works well for articles and pages but it doesn’t seem to work for custom post types.

    How can I make it work?

    Thanks again.

  14. Hi Lauren

    We put featured image and 2 other images inside the post. But when we click + and move to the translation panel we don’t see the images there that needs translation

  15. In WPML > Medial Translation, the only field to available for translation is “Name”. Alt, Caption, etc aren’t available. How can I change this?

    • Hi CHristopher, you can change the alt text, caption, etc by going to the Media Library. You can open the image you need to edit, and then use the admin language switcher at the top of the dashboard to switch to your secondary language. Here, you can add the translated caption, alt text, etc. I hope this helps!

  16. Hi Lauren. I don’t understand. The screenshot shows we can do it from the Media Translation view, so why should I go to the library (much less convenient in most cases)?

    • Please open a support ticket here so that a supporter can take a look at your site settings and help you translate the media information correctly. Thanks!

  17. Hi,

    We don’t use media translation, almost all our work is page rather than post related.

    After the latest media translation updates, we are finding new media is being duplicated by language and each language has a different media library – what settings should we choose so that there is just one library, it is the same regardless of language and any pdfs, images, etc uploaded are available in all languages?

    Thanks,

    David

    • Hi David,

      Handling media across the site is quite tricky and we decided to make it always “translated” for several technical reasons. We do not recommend to change this setting, but if you really want to, you can go to WPML -> Settings -> Post Types Translation. On the row related to “Media (attachment)”, click on the locker and select the mode you wish, then click save. Again, this is not something we recommend, but I think the mode “Translatable – use translation if available or fallback to default language” is better than “Translatable – only show translated items”.

      Thanks,
      Pierre