Getting Some JetPack Features to Work with Translation Plugins
-
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.
- The topic ‘Getting Some JetPack Features to Work with Translation Plugins’ is closed to new replies.