WordPress.org

Support

Support » Plugins and Hacks » Phrases and Block to NOT translate

Phrases and Block to NOT translate

  • Georg Ludwig
    Member

    @georg-ludwig

    I had the problem to NOT translate certain things like the company name or special phrases I’ve put into double brackets. Though I found a workaround in parser.php I’d be glad to have a portable solution in future releases if possible.

    Here’s my workaround:

    In the parser.php I’ve added the following excclusions:

    ` // Unicode – 2 Chars for the <<
    elseif ($string[$pos] == ‘«’) {
    $this->tag_phrase($string, $start, $pos-1);
    while ($string[$pos] != ‘»’ && $pos < strlen($string))
    $pos++;
    $pos++;
    $start = $pos;
    }
    elseif ($string[$pos] == ‘C’ && ($pos+10) < strlen($string) && substr($string, $pos, 11) == ‘Companyname’) {
    $this->tag_phrase($string, $start, $pos);
    $pos+=11;
    $start = $pos;
    }`

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Ofer Wald
    Participant

    @oferwald

    Hi,

    Do you have any good suggestion on how this will be made portable? 🙂

    Would be happy to hear, truly.

    Georg Ludwig
    Member

    @georg-ludwig

    Hi,

    in my Opinion this could be a simple solution as follows:

    • In the settings section offer the ability to enter phrases that shall not be translated as a CSV-String.
      Split the string into an array and use it with the sample code above to test on such phrases.
    • You may also offer to enter char-combinations that enclose phrases not to be translated, e.g. “<>,[],«»” – could be used to parse with the code above.
      The only problem is what I had: The « and » are held as unicode-character in my installation – perhaps You have a proper idea for that specific problem ?

    Regards,
    Georg

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Phrases and Block to NOT translate’ is closed to new replies.