• Resolved jjbte

    (@jjbte)


    I am using JetPack on a test website along with qTranslate-X, which is one of a few forks of the original, but apparently now dead, qTranslate. The plugin uses tags (in the form of <!–:en–> or [:en]) to separate content in different languages.

    Some of JetPack’s features seem to translate properly and others do not. Most frustrating is the lack of proper translation seen in JetPack tiled galleries. When I place such a gallery in the content of a page or post, nothing is translated. All image properties–title, caption, description, alt–are displayed with all language versions and the language tags.

    When I create a tiled gallery using JetPack’s Gallery widget, all image properties are translated properly except the alt text.

    When I use Carousel with these galleries, the results are the same as with the galleries themselves. If something is translated / not translated properly in the gallery, the same is true for Carousel.

    Since this is a test site, I did some investigating and experimenting and found that making some minor changes to carousel-image-args.php and item.php in the “jetpack/modules/tiled-gallery/tiled-gallery/templates/partials” directory, everything is translated properly for both gallery types and their Carousel counterparts.

    In item.php, I changed esc_attr to esc_attr_e for alt and title values, and I changed line 44 from
    wptexturize( $item->image->post_excerpt )
    to
    wptexturize( _e( $item->image->post_excerpt ) )

    In carousel-image-args.php, I changed lines 15 and 16 from

    data-image-title="<?php echo esc_attr( wptexturize( $item->image->post_title ) ); ?>"
    data-image-description="<?php echo esc_attr( wpautop( wptexturize( $item->image->post_content ) ) ); ?>"

    to

    data-image-title="<?php echo esc_attr( wptexturize( _e( $item->image->post_title ) ) ); ?>"
    data-image-description="<?php echo esc_attr( wpautop( wptexturize( _e( $item->image->post_content ) ) ) ); ?>"

    I really don’t want to mess with a plugin’s core files on a “real” site, so do I have any other options to get this to work properly? Any help would be appreciated.

    In addition to the gallery translation issues, I am also seeing issues with the Twitter share button on pages (it works properly on posts). When the tweet is composed for sharing a page, the title portion displays all languages as well as the language tags. The Facebook share button works properly on pages and posts.

    By the way, the gallery translation issue exists in WordPress’s built-in gallery shortcode as well. It isn’t exclusive to JetPack’s tiled galleries.

    https://www.ads-software.com/plugins/jetpack/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Adam Heckler

    (@adamkheckler)

    Do mind posting this as a Jetpack pull request here?

    https://github.com/Automattic/jetpack/pulls

    It seems to be involved enough that our developers should take a look at it, plus this:

    the gallery translation issue exists in WordPress’s built-in gallery shortcode as well. It isn’t exclusive to JetPack’s tiled galleries.

    … makes us think it could be some sort of issue with the qTranslate-X plugin.

    In any case, we’d suggest filing a PR so we can review and test the changes. ?? Thanks!

    Thread Starter jjbte

    (@jjbte)

    Per your request, I created a pull request for the changes I made to the two files Jetpack discussed (carousel-image-args.php and item.php). I hope I did everything correctly since I have never worked with GitHub beyond downloading applications.

    Over the past day, the qTranslate-X author also made some changes that did fix some of the photo gallery issues for both WordPress and Jetpack galleries. His fixes enabled proper translation for Caption and Alt in WP standard galleries. However, if the Alt field is empty, WP substitutes the Caption or Title if they have values. In this case, the Alt value is NOT translated properly.

    For Jetpack tiled galleries, all but the Alt value get translated properly. For Title, Caption, and Description, his fixes work with or without the changes I made to the two Jetpack files discussed here. My change to item.php is still necessary to get the Alt value to translate properly.

    In addition, his latest changes did NOT fix the Jetpack Twitter share button issue I discussed previously.

    If you wish to take a look at the latest version of qTranslate-X, the author has been posting alpha versions in his own GitHub repository. I believe this fork of qTranslate, which was quite popular from what I have read, is the winner among the different forks that came to be after the original qTranslate plugin ceased development. The other forks seem to have died off already, while the qTranslate-X author has been very helpful and responsive.

    Thank you for your response. I like many of Jetpack’s features, and I especially like the ability to create small, attractive photo galleries without the need for a whole separate plugin.

    Plugin Contributor Adam Heckler

    (@adamkheckler)

    However, if the Alt field is empty, WP substitutes the Caption or Title if they have values. In this case, the Alt value is NOT translated properly.

    For Jetpack tiled galleries, all but the Alt value get translated properly. For Title, Caption, and Description, his fixes work with or without the changes I made to the two Jetpack files discussed here. My change to item.php is still necessary to get the Alt value to translate properly.

    In addition, his latest changes did NOT fix the Jetpack Twitter share button issue I discussed previously.

    Does the pull request you submitted fix these problems? If not, I’d suggest updating it with a fix for them as well. ??

    Or am I misunderstanding what you are pointing out here?

    Thread Starter jjbte

    (@jjbte)

    No, sorry… I only mentioned the WP issue because I had mentioned it in my original post, simply to point out that the gallery translation issue wasn’t just with Jetpack galleries.

    I have not yet figured out a fix for the WP issue. As I discussed, the qTranslate-X developer did partially fix it. As long as the Alt field has a value, everything is fine.

    I realize it can be tough to get all themes and plugins to work together, especially with a plugin like qTranslate-X. Ideally, I try to customize various styles and functions via my child theme, but the WP and Jetpack gallery functions are fairly complex and I haven’t come up with a good child-theme solution.

    Thread Starter jjbte

    (@jjbte)

    I was able to fix the Twitter share button issue I discusses previously. qTranslate-X allows for the input of custom filters on its settings page (under Advanced Settings). I added the filter “sharing_title” to my qTranslate-X settings and now my page titles are being translated properly when I use the Twitter share button.

    On a side note, I was able to fix a similar issue with the Jetpack Top Posts & Pages widget. Post and page titles would be listed in all language versions as well as the language tags used by qTranslate-X. I added the filter “jetpack_widget_get_top_posts” to my qTranslate-X settings and top page/post titles are now translated properly.

    The only Jetpack/qTranslate-X issue I have not been able to solve (without making changes to Jetpack files) is translating the Alt text for photos in photo galleries.

    I hope this info helps anyone trying to use qTranslate-X with Jetpack.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Getting Some JetPack Features to Work with Translation Plugins’ is closed to new replies.