Support » Plugin: WooCommerce Side Cart (Ajax) » Sidebar text not translated by WPML string translation

  • Hi,
    This looks like a great plugin. I’m testing it on one of my sites.

    The site has WPML with 3 languages. I have translated the texts in the sidebar with WPML string translation, but they don’t seem to get translated. All the strings stay in English.

    Do you have any plans on making this plugin WPML compatible?

    Thanks,
    Andras

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello @aguseo,

    Did you find a solution for this? I have the same problem.

    Strings are translated via WPML in back-end but don’t translate in front-end.

    Tried .po/.mo like in documentation, but without success.

    Thanks

    I have a workaround but requires coding.

    1. Created an override for the necessary files.
    2. In the override I changed the strings. They are added there as variables which pulls the values from the settings. I hard coded the strings in a translateable way like _e( 'View Cart', 'text-domain' );
    3. Used Loco Translate to manually add these hard coded strings to the .pot file of the plugin.
    4. Used Loco Translate to create the translation files for the languages I needed and translated the strings there.

    And then it works like a charm. 🙂

    The risky part is if there is a plugin update and the templates change, then you need to carry over those changes to your template overrides. I did this before with a theme and it was a nightmare, b/c the theme developers changed something on the template files at every release. So I stopped using that theme at the end.

    So I hope that there are not going to be too many changes here.

    Let me know if you need further help with executing this. I’m happy to help.

    Cheers,
    Andras

    Might be worth using esc_html_e instead of only _e now that I think of it.

    Hello @aguseo,

    Thank you for the solution. I ended up doing it with JS instead in case of a plugin update (like you mentioned).

    So, for everybody else losing patience like me, here’s a (not so good) solution:

    
    jQuery(document).ready(function ($) {
      $(document).ajaxComplete(function(){
          var lang = $('html').attr('lang');
      
          if(lang == 'fr') {
              $('.xoo-wsc-ft-btn-continue').text('Continuer à magasiner');
              $('.xoo-wsc-ft-btn-cart').text('Voir le panier');
              $('.xoo-wsc-ft-btn-checkout').text('Commander');
          }
        });
      
    });
    

    Thanks!

    Plugin Author xootix

    (@xootix)

    Hi Everyone,

    So I spent some time in figuring out the issue.
    Looks like plugin is loading before WPML.
    Please add this to your functions.php.
    You don’t have to edit plugin files after this.
    Thanks for opening a ticket. I will fix this in the next update.

    add_action( 'plugins_loaded', function(){
    	remove_action( 'plugins_loaded','xoo_wsc_init', 9 );
    	add_action( 'plugins_loaded','xoo_wsc_init', 15 );
    }, 5 );
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.