From a299085de9f80e028bdf9b37a96720c0d1016219 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 15 Sep 2011 11:25:01 +0800 Subject: [PATCH] DataObjects/I18n.php --- DataObjects/I18n.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/DataObjects/I18n.php b/DataObjects/I18n.php index 0e899d2e..d823e75d 100644 --- a/DataObjects/I18n.php +++ b/DataObjects/I18n.php @@ -25,6 +25,8 @@ class Pman_Core_DataObjects_I18n extends DB_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE + static $cfg; // the default configuration. + function applyFilters($q, $au) { @@ -43,6 +45,47 @@ class Pman_Core_DataObjects_I18n extends DB_DataObject + } + function buildDB($ltype= false, $inlang= false ) + { + if ($ltype === false) { + die("OOPS NO LTYPE"); + } + if ($inlang == '**') { + return; // dont bother building generic.. + } + + + if ($inlang === false) { + foreach( $this->cfg['t'] as $l) { + $this->buildDB($ltype, $l); + } + return; + } + + $list = $this->getDefaultCfg($ltype); + + DB_DataObject::debugLevel(1); + + foreach($list as $lkey) { + $x = DB_DataObject::factory('i18n'); + $x->ltype = $ltype; + $x->lkey = $lkey; + $x->inlang= $inlang; + if ($x->find(true)) { + $xx= clone($x); + $x->lval = $this->translate($inlang, $ltype, $lkey); + $x->update($xx); + continue; + } + $x->lval = $this->translate($inlang, $ltype, $lkey); + $x->insert(); + + } + + + + } -- 2.39.2