WordPress.org

Ready to get started?Download WordPress

Forums

Transposh WordPress Translation
Fix for Complicate Themes to properly translate (4 posts)

  1. Arturo emilio
    Member
    Posted 2 years ago #

    When you have a fancy theme with a lot of html entities alround you may find some strings are not translated.
    Even if you change value for

    define('ENT_BREAKS', FALSE); // Will an HTML entity break a phrase

    It stills does not translate properly because of the formating.
    One way it works for me was stripping down all the html tags from the string to translate.
    First you set

    define('ENT_BREAKS', FALSE);

    in core/parser.php
    Then you do this changes:

    function parsetext($string) {
    $pos = 0;
    // $pos = skip_white_space($string, $pos);
    // skip CDATA in feed_fix mode
    if ($this->feed_fix) {
    if (strpos($string, '<![CDATA[') === 0) {
    $pos = 9; // CDATA length
    $string = substr($string, 0, -3); // chop the last ]]>;
    }
    }

    $start = $pos;

    you may add:

    if (!ENT_BREAKS){
    strip_tags($string);
    }

    First translation will look strange, the text styles could get strange. Reload the page and it will look fine.
    To avoid this glitch would be enough if the developers make the plugin to load always from cache, even after the page is just translated.
    I hope the developers include this change in the code in the next version.

    http://wordpress.org/extend/plugins/transposh-translation-filter-for-wordpress/

  2. Ofer Wald
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for your message, I am not sure that this will go in to next versions, but will consider this.

    I didn't understand your comment about loading from cache, can you try explaining this again?

  3. Arturo emilio
    Member
    Posted 2 years ago #

    Thank you for keep watching over this forums.
    You should keep in mind this or something like this bug fix, because with HTML5 the plugin is buggy. Actually it does not respect the tags from html5.
    This is mainly because the plugin uses <span> class tags to identify the text to translate but doesnt keep it's proper places, the plugin insert the translated text after the <cufontext> tags. Also can't get the text right if there is much coding in html5, so the texts are not translated.
    One quick fix (although is also buggy) is to change <span> tags that the plugin insert for <div> but the texts keep been inserted after the cufon.

    This is only happening the first time the page is loaded in that language, after that the translations get properly inserted and the page looks fine.
    So I guess using some tag to identify the text to change is vital, would be enough if the plugin didn't show the page straight but did like the strings are loaded from the database
    After update_database() try to load again from fetch_database(arg1,arg2) to emulate like the page is loaded second time. I'm trying to get it working but not success yet.

  4. Ofer Wald
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,

    The cufontext is not an html5 tag, the problem is that cufon messes up the html after loading via the script, it does not expect tags within its own tag while this may happen (apparently), this messes the text transposh should translate, so for now, Transposh and cufon are not friends.

    The best hack around this (for now) is to disable cufon on translated language pages.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic