*/
require_once 'Pman.php';
-class Pman_Core_i18N extends Pman
+class Pman_Core_I18N extends Pman
{
//}
$this->authUser = $au;
- $opts = PEAR::getStaticProperty('Pman_Core_I18N', 'options');
- if (empty($opts)) {
- $opts = PEAR::getStaticProperty('Pman_I18N', 'options');
- }
- $opts = empty($opts) ? array() : $opts;
+ $ff= HTML_FlexyFramework::get();
+
+
+ $opts = empty($ff->Pman_Core_I18N) ? (empty($ff->Pman_I18N) ? array() : $ff->Pman_I18N) : $ff->Pman_Core_I18N;
+
// load the cofiguration
foreach($opts as $k=>$v) {
- if ($v == '*') {
+ if ($v == '*') { // everything..
$this->cfg[$k] = $this->getDefaultCfg($k);
continue;
}
case 'BuildDB':
// by admin only?!?
//DB_DataObject::debugLevel(1);
- $this->buildDb('l');
- $this->buildDb('c');
- $this->buildDb('m');
+ $i = DB_DataObject::Factory('I18n');
+ $i->buildDb();
die("DONE!");
break;
'm' => $this->objToList('m', new I18Nv2_Currency($rlang, 'UTF-8'))
);
}
+ //echo '<PRE>';print_r($ar);
header('Content-type: text/javascript');
echo 'Pman.I18n.Data = ' . json_encode($ar);
exit;
}
function objToList($type, $obj) {
$ret = array();
-
-
-
+
+
foreach($this->cfg[$type] as $k) {
- $v = $obj->getName($k);
+ $sub = false;
+
+ if (strpos($k, '_') !== false) {
+ $bits = explode('_', $k);
+ $k = array_shift($bits);
+ $sub = array_shift($bits);
+ }
+ $v = $k == '**' ? 'Other' : $obj->getName($k);
+
+ if ($sub) {
+ $v .= ' ('.$sub.')';
+ }
$ret[] = array(
- 'code'=> $type=='l' ? strtolower($k) : strtoupper($k),
+ 'code'=> ($type=='l' ? strtolower($k) : strtoupper($k)) . ($sub ? '_'.strtoupper($sub) : ''),
'title' => $v
);
}
}
-
-
-
- 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();
-
- }
-
-
-
-
- }
+
}
\ No newline at end of file