Changeset 199


Ignore:
Timestamp:
03/05/08 16:16:52 (16 years ago)
Author:
niltonneto
Message:

Ver Ticket #149: Revisão da internacionalização

Location:
trunk/phpgwapi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpgwapi/inc/class.translation_sql.inc.php

    r2 r199  
    176176                } 
    177177 
     178 
     179          function translate_async($key,$vars=false, $not_found='*' ) 
     180          { 
     181            $lindex = $_SESSION['phpgw_info']['calendar']['langAlarm']; 
     182            if (!is_array(@$lindex) || !count($lindex)) 
     183              { 
     184                $this->init(); 
     185              } 
     186            $ret = $key.$not_found;     // save key if we dont find a translation 
     187             
     188            if (isset($lindex[$key])) 
     189              { 
     190                $ret = $lindex[$key]; 
     191              } 
     192            else 
     193              { 
     194                $new_key = strtolower(trim(substr($key,0,MAX_MESSAGE_ID_LENGTH))); 
     195                 
     196                if (isset($lindex[$new_key])) 
     197                  { 
     198                    // we save the original key for performance 
     199                    $ret = $lindex[$key] = $lindex[$new_key]; 
     200                  } 
     201              } 
     202            if (is_array($vars) && count($vars)) 
     203              { 
     204                if (count($vars) > 1) 
     205                  { 
     206                    $ret = str_replace($this->placeholders,$vars,$ret); 
     207                  } 
     208                else 
     209                  { 
     210                    $ret = str_replace('%1',$vars[0],$ret); 
     211                  } 
     212              } 
     213            return $ret; 
     214          } 
     215 
    178216                /*! 
    179217                @function add_app 
Note: See TracChangeset for help on using the changeset viewer.