Skip Navigation

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 4 replies, has 2 voices.

Last updated by Andreas W. 1 year, 10 months ago.

Assisted by: Andreas W..

Author Posts
May 6, 2022 at 2:05 pm #11168523

Johannes C

Recreated on Sandbox

May 7, 2022 at 5:15 am #11172247

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Thank you for your patience.

Please take note that the MB Views Plugin so far not has been tested by our team:
https://wpml.org/plugin/?wpv_view_count=120064&wpv-plugin-functionality=0&wpv_post_search=views&wpv-wpcf-recommendation-flag=&wpv_filter_submit=Search

The issue(s) have been escalated to our compatibility team for further revision. As soon I received feedback from our team I will be in contact with you again.

Best regards
Andreas

May 7, 2022 at 9:47 am #11172641

Johannes C

Thank you, Andreas, for looking into this! You are a great support.

I found a workaround that works quite well:

  • 1. Creating the MB View in English.
  • 2. Translating it with or w/o WPML's Translation Editor. Without works better because it doesn't destroy Twig expressions. It also generates a new View name (basically the ID).
  • 3. Using the apply_filters( 'wpml_current_language', mixed $empty_value ) hook in my template files to insert different MB View shortcodes or custom WP actions depending on the language.

Example below. Also a custom action hook could be created to do the same.

<?php $current_lang = apply_filters( 'wpml_current_language', NULL ); ?>
<?php if ($current_lang == 'de'): ?>
   <?php echo do_shortcode('[mbv name="shortcodetitle_de"]'); ?> 
<?php else: ?>
   <?php echo do_shortcode('[mbv name="shortcodetitle"]'); ?> 
<?php endif;?> 

Maybe it helps others in the future and/or the compatibility team to find a technical solution.

All the best,
Johannes

May 7, 2022 at 5:41 pm #11173389

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello Johannes,

Thank you very much for your message.

I have forwarded this workaround to the team.

It is in fact the case, that if you translate other plugins that use shortcodes with WPML, those shortcodes each usually have a proper ID in each language.

Maybe the issue is here, that the same shortcode is used in both languages.

I will get back to you about this once I have more feedback from our team.

Best regards
Andreas

May 18, 2022 at 2:47 am #11242743

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

I would like to suggest another workaround for the reported issue:

The plugin shortcode here actually uses the page slug.

At WPML > Settings > Translated documents options > Page URL and select this option:

Translate (this will include the slug in the translation and not create it automatically from the title).

After that, you can manually translate the shortcode name and add it manually per language using the WordPress editor or keep using a custom code as you did already.

Best regards
Andreas

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.