/[cvs]/nfo/php/libs/org.netfrag.flib/Application/l10n/LocaleText.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.flib/Application/l10n/LocaleText.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by joko, Thu Dec 19 10:30:06 2002 UTC revision 1.7 by joko, Tue May 13 09:40:34 2003 UTC
# Line 3  Line 3 
3  //    $Id$  //    $Id$
4  //    ------------------------------------------------------------------  //    ------------------------------------------------------------------
5  //    $Log$  //    $Log$
6    //    Revision 1.7  2003/05/13 09:40:34  joko
7    //    check for error...
8    //
9    //    Revision 1.6  2003/02/09 17:33:54  joko
10    //    + minor update related to new log level constants
11    //
12  //    Revision 1.5  2002/12/19 10:30:06  joko  //    Revision 1.5  2002/12/19 10:30:06  joko
13  //    + argument 'newMode' for function getlt and function _getldsvar: let _getldsvar evaluate variable to still provide old behaviour/functionality  //    + argument 'newMode' for function getlt and function _getldsvar: let _getldsvar evaluate variable to still provide old behaviour/functionality
14  //  //
# Line 59  class LocaleText { Line 65  class LocaleText {
65    // ----------------------------------------------------    // ----------------------------------------------------
66    function LocaleText() {    function LocaleText() {
67    
     /*  
     // was:  
     global $cfg, $slt;  
     session_register_safe('slt');  
     $this->langs_avail = $cfg[GLBL_LANGSAVAIL];  
     $this->load();  
     */  
       
68      // look at the bottom of this file!!!      // look at the bottom of this file!!!
69      //$smarty->register_block("translate", "do_translation");      //$smarty->register_block("translate", "do_translation");
70      //$this->site->smarty->register_block("translate", "_do_translation");      //$this->site->smarty->register_block("translate", "_do_translation");
# Line 77  class LocaleText { Line 75  class LocaleText {
75    }    }
76    
77    function start() {    function start() {
78      global $cfg, $slt;      global $app, $slt;
79      session_register_safe('slt');      session_register_safe('slt');
80      $this->langs_avail = $cfg[GLBL_LANGSAVAIL];      $this->langs_avail = $app->getConfig("languages.available");
81      $this->load();      $this->load();
82    }    }
83    
# Line 113  class LocaleText { Line 111  class LocaleText {
111        return $langs_avail[0];        return $langs_avail[0];
112      }      }
113    }    }
114      
115      // TODO: refactor this to Data::Deep  
116    function _dbkey2ldskey($dbkey) {    function _dbkey2ldskey($dbkey) {
117      // TODO: log this      // TODO: log this
118      //dprint("dbkey: $dbkey");      //dprint("dbkey: $dbkey");
# Line 127  class LocaleText { Line 126  class LocaleText {
126      }      }
127    }    }
128        
129      // TODO: refactor this to Data::Deep  
130    function _getldsvar($ldskey, $tpl=array(), $newMode = 0) {    function _getldsvar($ldskey, $tpl=array(), $newMode = 0) {
131            
132  //print "ldskey: $ldskey<br>";  //print "ldskey: $ldskey<br>";
# Line 153  class LocaleText { Line 153  class LocaleText {
153      return $var_value;      return $var_value;
154    }    }
155        
156      // TODO: refactor this to Data::Deep  
157    function _setldsvar($ldskey, $val) {    function _setldsvar($ldskey, $val) {
158      $var_name = '$this->lds' . $ldskey;      $var_name = '$this->lds' . $ldskey;
159      $value_new = addslashes($val);      $value_new = addslashes($val);
# Line 163  class LocaleText { Line 164  class LocaleText {
164    }    }
165        
166    function _loadStructure_FromDb() {    function _loadStructure_FromDb() {
167      //global $site;      $this->site->log( get_class($this) . "->_loadStructure_FromDb: Loading language information (l10n) for '$this->langkey'.", PEAR_LOG_DEBUG);
     $this->site->log( get_class($this) . "->_loadStructure_FromDb loading language information", LOG_DEBUG);  
     //print "- loading structure from db ($this->langkey)<br>";  
     //connectdb();  
168      $sql = "SELECT * FROM td_res_langtext WHERE countrykey='" . $this->langkey . "'";      $sql = "SELECT * FROM td_res_langtext WHERE countrykey='" . $this->langkey . "'";
169      if ($result = $this->site->db->query($sql)) {      if ($result = $this->site->db->query($sql)) {
170          
171          // pre-flight check: Is $result an object of class "db_error"?
172          if (get_class($result) == 'db_error') {
173            // FIXME: How to handle this here???
174            //print "Sorry.<br/>";
175            $this->site->log( get_class($this) . "->_loadStructure_FromDb: Error while issuing '$sql'.", PEAR_LOG_ERR);
176            return;
177          }
178          
179        //while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {        //while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
180          //print Dumper($result);
181        while ( $result->fetchInto($row) ) {        while ( $result->fetchInto($row) ) {
182           //print $row[tval]."<br>";           //print $row[tval]."<br>";
183           //print_r($row) . "<br>";           //print_r($row) . "<br>";
184            $this->_loadStructure_FromDb_add($row["tkey"], $row["tval"]);            $this->_loadStructure_FromDb_add($row["tkey"], $row["tval"]);
185        }        }
186      }      }
187      $this->site->log( get_class($this) . "->_loadStructure_FromDb ready", LOG_DEBUG);      $this->site->log( get_class($this) . "->_loadStructure_FromDb ready", PEAR_LOG_DEBUG);
188    }    }
189        
190    function _loadStructure_FromDb_add($dbkey, $val) {    function _loadStructure_FromDb_add($dbkey, $val) {

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.7

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed