• Resolved deanes

    (@deanes)


    HI.
    All going well with TranslatePress except I have encountered a problem of broken HTML when the language is switched.
    I have tried the Advanced Options to 1.Fix Spaces & 2.Fix Broken HTML but the issue remains.
    Could you have a look and see if there’s anything obvious?
    The site is built on Elementor, using the OceanWP theme and the content with the problem is generated using the OceanWP Block Grid for Elementor plug-in.

    Thanks

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Dragos

    (@dragosvrejiu)

    Hello,

    Thank you for getting in touch!

    Could you please try adding the data-no-translation attribute to the text that gets broken?

    https://translatepress.com/docs/developers/exclude-certain-text-or-element-from-being-translated/

    Let me know how this goes.

    Best regards,

    Thread Starter deanes

    (@deanes)

    Hi.
    It’s not a paragraph of text that I can add html code to.
    On the website homepage you see a left sidebar which is made using an Elementor plug-in to query posts- all the elements displayed here are entered via fields in Elementor, none of the fields allow html input.

    This is what I have tried…

    In Elementor I have added an ‘CSS ID’ to the whole sidebar section; ‘vehicle-sidebar’.
    From your linked page I took the code and added this to my Theme Function.php :

    add_filter( 'trp_no_translate_selectors', 'trpc_no_stranslate_selectors', 10, 2);
    function trpc_no_stranslate_selectors($selectors_array, $language){
        $selectors_array[] = '#vehicle-sidebar';
        return $selectors_array;
    }

    but it made no difference.

    I also tried the Translate Press options in Elementor Advanced tab for the Section – I was hoping one of these switches would just prevent translation but still display content in English for both languages selections – but the Elementor settings both had the same effect of hiding the section completely when second language selected;
    *Restrict by Language – set to English (shows in English hidden in Thai Language)
    *Exclude from English – set to Thai (shows in English hidden in Thai Language)

    As I mentioned Translate Press is breaking the HTML this is the code from Developer Tools;
    ENGLISH

    <div class="oew-grid-media clr">
    <p>
    <a href="https://krabigreenday.omnisvision.com/nissan-march-2/" title="Nissan March" class="oew-grid-img"></a>
    </p>

    THAI

    <div class="oew-grid-media clr">
    <p>
    <a href="https://krabigreenday.omnisvision.com/th/nissan-march-2/" title="<trp-post-container data-trp-post-id=">Nissan March” class=”oew-grid-img”></a>
    </p>

    Please note in this case I don’t even want the Titles of the car names ‘Nissan March’ translated into a second language. I want them displayed as ‘Nissan March’ throughout.

    Any suggestions would be gratefully received.

    thanks

    • This reply was modified 4 years, 9 months ago by deanes.
    • This reply was modified 4 years, 9 months ago by deanes. Reason: edit code formatting
    Dragos

    (@dragosvrejiu)

    Hello,

    This is a bug and it will get fixed in the next update of TranslatePress.(Which will be released in one week)

    However,if you need the fix sooner, we can provide a custom code which you can use to fix this.

    Thank you for understanding!

    With the best regards,

    Thread Starter deanes

    (@deanes)

    Hi Dragos
    Thanks for the update.
    I can wait for your next update. The site with the problem is still being developed. I will let you know if issues persist after the next update.
    thanks

    Thread Starter deanes

    (@deanes)

    Hi
    I have now updated Translate Press to v1.6.7 unfortunately the same sidebar is still broken when switched to the second language.
    The appearance is significantly different to when using the previous version of translate press but it looks like the html is still getting broken in the process.
    With v1.6.7 I tried the various options in the Advance Tab of Settings but none of these made any difference.
    If I roll back to Translate Press v1.6.4 then the sidebar appears as expected.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Broken HTML with second language’ is closed to new replies.