Changeset 781


Ignore:
Timestamp:
02/17/13 15:34:25 (21 months ago)
Author:
ofer
Message:

Better handling of   (We breaked when this is a no_break), and we also eliminate the hidden ones, for we can't see them and they cause space truncation and misses

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WordPress/plugin/transposh/core/parser.php

    r745 r781  
    297297        $entities = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐ' . 
    298298                'ÑÒÓÔÕÖØÙÚÛÜÝÞß' . 
    299                 'øùÿœš'; 
     299                'øùÿœš '; 
    300300        return (stripos($entities, $entity) !== FALSE); 
    301301    } 
     
    338338        $phrase = trim(substr($string, $start, $end - $start)); 
    339339//        $logstr = str_replace(array(chr(1),chr(2),chr(3),chr(4)), array('[1]','[2]','[3]','[4]'), $string); 
    340 //        logger ("p:$phrase, s:$logstr, st:$start, en:$end, gt:{$this->in_get_text}, gti:{$this->in_get_text_inner}"); 
    341 //        logger (''); 
     340//        tp_logger ("p:$phrase, s:$logstr, st:$start, en:$end, gt:{$this->in_get_text}, gti:{$this->in_get_text_inner}"); 
    342341        if ($this->in_get_text > $this->in_get_text_inner) { 
    343342            tp_logger('not tagging ' . $phrase . ' assumed gettext translated', 4); 
     
    664663 
    665664        // create our dom 
     665        $string = str_replace(chr(0xC2) . chr(0xA0), ' ', $string); // annoying NBSPs? 
    666666        $this->html = str_get_html($string); 
    667667        // mark translateable elements 
    668         $this->html->find('html', 0)->lang = ''; // Document defined lang may be preset to correct lang, but should be ignored TODO: Better? 
     668        if ($this->html->find('html', 0)) 
     669                $this->html->find('html', 0)->lang = ''; // Document defined lang may be preset to correct lang, but should be ignored TODO: Better? 
    669670        $this->translate_tagging($this->html->root); 
    670671 
    671672        // first fix the html tag itself - we might need to to the same for all such attributes with flipping 
    672         if ($this->dir_rtl) $this->html->find('html', 0)->dir = 'rtl'; 
    673         else $this->html->find('html', 0)->dir = 'ltr'; 
     673        if ($this->html->find('html', 0)) { 
     674            if ($this->dir_rtl) $this->html->find('html', 0)->dir = 'rtl'; 
     675            else $this->html->find('html', 0)->dir = 'ltr'; 
     676        } 
    674677 
    675678        if ($this->lang) { 
    676             $this->html->find('html', 0)->lang = $this->lang; 
     679            if ($this->html->find('html', 0)) 
     680                    $this->html->find('html', 0)->lang = $this->lang; 
    677681            // add support for <meta name="language" content="<lang>"> 
    678682            if ($this->html->find('meta[name=language]')) { 
Note: See TracChangeset for help on using the changeset viewer.