Support » Plugin: TranslatePress - Translate Multilingual sites » Translation not working after DOM change?

  • Resolved tcsmox

    (@tcsmox)


    I have a site where i had to use javascript to move the content of a div into another one and show it as a popup. Unfortunately the translations do not work on the popup. The code is similar to this one:

    var content = $('.post-content').html();
    $modal.find('.post-content').html(content);

    Is there a function that i can call to enable the translation?
    According to this documentation, this plugin has a dom change listener:
    https://translatepress.com/translate-ajax-strings-wordpress/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Razvan Mocanu

    (@razvanmo-1)

    Hello

    JS operations done with html() should be detected by the DOM change listener.
    Is it possible to provide the entire code and steps on how to replicate the behaviour?

    Hi, I’m sorry for the delay, here is the code:

    $('.box-container .toggler').on('click', function ()
    {
    	  $(this).toggleClass('active');
    	  var content = $(this).parents('.box').find('.post-content').html();
    
    	  var $modal = $('#post-box-popup');
    	  $modal.find('.post-content').html(content);
    
    	  $modal.fadeIn().css({top: offset.top + 40});
    
    	  $modal.find('.close').on('click', function ()
    	  {
    			$modal.fadeOut();
    	  });
    
    });
    • This reply was modified 1 year, 1 month ago by tcsmox.
    Plugin Author Razvan Mocanu

    (@razvanmo-1)

    Hello,

    It’s not possible for me to replicate your scenario with only this function.
    Please open a support ticket and send me a link to your website if possible.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Translation not working after DOM change?’ is closed to new replies.