Changeset 84


Ignore:
Timestamp:
03/20/2009 10:38:37 PM (3 years ago)
Author:
ofer
Message:

Update to the number code, looks a bit better on transposh.org

File:
1 edited

Legend:

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

    r80 r84  
    424424                                translate_text($start); 
    425425                                $pos = $start = $end_of_number; 
    426                         }                        
     426                        } 
    427427                        else 
    428428                        { 
     
    585585/* 
    586586 * Determines if the current position marks the begining of a number, e.g. 123 050-391212232 
    587  *  
    588  * Return 0 if not a number otherwise return the position past this number.  
     587 * 
     588 * Return 0 if not a number otherwise return the position past this number. 
    589589 */ 
    590590function is_number($position) 
     
    592592        global $page; 
    593593        $start = $position; 
    594          
    595         while(is_digit($position) || $page[$position] == '-' || $page[$position] == '+') 
     594 
     595        while(is_digit($position) || $page[$position] == '-' || $page[$position] == '+' || 
     596         (($page[$position] == ',' || $page[$position] == '.' || $page[$position] == '\\' || $page[$position] == '/') && is_digit($position+1))) 
    596597        { 
    597598                $position++; 
    598599        } 
    599          
     600 
    600601        if($position != $start && (is_white_space($position) || $page[$position] == '<')) 
    601602        { 
    602                 return $position;                
    603         } 
    604          
     603                return $position; 
     604        } 
     605 
    605606        return 0; 
    606607} 
     
    783784                // We will mark translated text with tr_t class and untranslated with tr_u 
    784785                $span = "<span class=\"$span_prefix"; 
    785                  
     786 
    786787                //Use base64 encoding to make that when the page is translated (i.e. update_translation) we 
    787         //get back exactlly the same string without having the client decode/encode it in anyway.  
     788        //get back exactlly the same string without having the client decode/encode it in anyway. 
    788789        $token = "token=\"" . base64_encode($original_text) . "\""; 
    789                  
     790 
    790791        if($translated_text == NULL) 
    791792                { 
     
    821822                } 
    822823        } 
    823          
     824 
    824825        logger("Exit " . __METHOD__  . " : $original_text" , 4); 
    825826} 
Note: See TracChangeset for help on using the changeset viewer.