Home Forums Add-ons Gallery Field Gallery Field and WPML Reply To: Gallery Field and WPML

  • Hey,

    since I just ran into the same problem I am posting what I found out to make it work in my environment. Maybe it’ll help you and others (possible duplicate: to get this to work.
    I have a WPML setup with 3 languages and needed title, caption und alt translations.

    A. First you have to install the “WPML Media-plugin” from the WPML toolkit, and run through it’s setup. It creates database-duplicates of all your media giving you the possibility to translate the meta information.
    B. Once done, go to WP-Media and click “edit” on the attachment you want to translate.
    C. If you now change your selected language via the WPML adminbar switch you are able to put in translations for captions and such. You can confirm your success when hitting the save button and watching the permalink of the attachment being appended by a number like slug-2.jpg (if you don’t change the title).

    By the magic of code img[‘caption’] will then return the caption in the right language. This worked for me with gallery and image fields. However, if you try to change your caption and such within the gallery-field in post-edit screen off a translation, you are only changing it’s default language data.
    SO: If you have the WPML-Plugin installed and switch to a translation or create a new one, clear the gallery images and reselect them, WP will automaticaly provide you with the translated attachment-copys in the insert-media-box. Doing it in this “clean” manner will even enable you to edit the metadata within the acf-field for the currently selected language only.

    Hope that help’s and is somewhat clear (english is not my mothertongue).

    To Mr. Condon, thank you for this wonderfull piece of code!