// languages available
'l' => array(
- 'en', 'zh_CN', 'zh_HK', 'zh_TW', 'th', 'ko', 'ja', 'ms',
- 'id', // indonesian
- 'tl', // tagalog
- 'vi', //vietnamise
- 'hi', // hindi
- 'ta', // tamil
- '**', // other
+ 'en', 'zh_CN', 'zh_HK', 'zh_TW', //'th', 'ko', 'ja', 'ms',
+ //'id', // indonesian
+ // 'tl', // tagalog
+ // 'vi', //vietnamise
+ // 'hi', // hindi
+ // 'ta', // tamil
+ // '**', // other
),
'c' => array(
'AU', 'CN', 'HK', 'IN', 'ID', 'JP', 'MY', 'NZ', 'TW', 'SG', 'TH', 'KR', 'US', 'PH', 'VN','**'
),
'add_l'=> array(), // additional languages...
'add_c'=> array(), // additional countries...(eg. '-R' => 'Regional' )
+ 'add_m'=> array(), // additional currencies...
+
);
/**
");
}
+ if (!empty($q['query']['name'])) {
+ //DB_DAtaObject::debugLevel(1);
+
+ $this->whereAdd("lval LIKE '". $this->escape($q['query']['name']). "%'");
+ }
}
function toTransList($ltype, $inlang)
{
- $x = DB_DataObject::factory('i18n');
- $x->ltype = $ltype;
- $x->inlang= $inlang;
- $x->selectAdd();
- $x->selectAdd('lkey as code, lval as title');
- $x->find();
+
+ $this->ltype = $ltype;
+ $this->inlang= $inlang;
+ $this->selectAdd();
+ $this->selectAdd('lkey as code, lval as title');
+
+ $this->find();
$ret = array();
- while ($x->fetch()) {
+ while ($this->fetch()) {
$ret[] = array(
- 'code' => $x->code,
- 'title' =>$x->title);
+ 'code' => $this->code,
+ 'title' => $this->title
+ );
}
return $ret;
}
{
$ret = array();
$cfg = $this->cfg();
-
+
switch ($t) {
case 'c':
require_once 'I18Nv2/Country.php';
case 'l':
require_once 'I18Nv2/Language.php';
$c = new I18Nv2_Language('en');
- $ret = array_keys($c->codes);
+ $ret = array_keys($c->codes); // we need to make sure these are lowercase!!!
+ foreach ($cfg['add_l'] as $k=>$v){
+ $tolang = explode('_', $k);
+ $tolang[0] = strtolower($tolang[0]);
+ $tolang = implode('_', $tolang);
+ $cfg['add_l'][$tolang] = $v;
+ unset($cfg['add_l'][$k]);
+ }
if (!empty($cfg['add_l'])) {
$ret = array_merge($ret, array_keys($cfg['add_l']));
}
+
$ret[] = '**';
break;
case 'm':
}
foreach ($ret as $k=>$v) {
- $ret[$k] = strtoupper($v);
+ $ret[$k] = ($t=='l') ? $ret[$k] : strtoupper($v);
}
-
-
+
return $ret;
}
function buildDB($ltype= false, $inlang= false )
{
- $this->cfg();
+ $cfg = $this->cfg();
if ($ltype === false) {
// trigger all builds.
//DB_DataObject::debugLevel(1);
$this->buildDB('m');
return;
}
+
if ($inlang == '**') {
return; // dont bother building generic..
}
// We only build translatiosn for our configured ones..
//foreach( $this->availableCodes('l') as $l) {
- foreach( self::$cfg['t'] as $l) {
+ foreach( $cfg['t'] as $l) {
$this->buildDB($ltype, $l);
}
return;
//DB_DataObject::debugLevel(1);
- $x = DB_DataObject::factory('i18n');
+ $x = DB_DataObject::factory('I18n');
$x->inlang= $inlang;
$x->ltype = $ltype;
if (in_array($lkey, $complete)) {
continue;
}
- $x = DB_DataObject::factory('i18n');
+ if (empty($lkey)) { // not sure why we get empty values here.
+ continue;
+ }
+ $x = DB_DataObject::factory('I18n');
$x->ltype = $ltype;
- $x->lkey = $lkey;
+ $x->lkey = $lkey;
$x->inlang= $inlang;
if ($x->find(true)) {
$xx= clone($x);
{
static $cache;
-
+ $cfg = $this->cfg();
if (empty($k)) {
return '??';
}
-
- $lbits = explode('_', strtoupper($lang));
+
+ //$lbits = explode('_', strtoupper($lang));
+ $lbits = explode('_', $lang);
+
$lang = $lbits[0];
if (!isset($cache[$lang])) {
if ($k == '**') {
return 'Other / Unknown';
}
-
+ $ret = $cache[$lang][$type]->getName($k);
if ($type == 'l') {
$tolang = explode('_', $k);
-
+
$ret = $cache[$lang][$type]->getName($tolang[0]);
if (count($tolang) > 1) {
$ret.= '('.$tolang[1].')';
}
- return $ret;
}
- $ret = $cache[$lang][$type]->getName($k);
- //print_r(array($k, $ret));
+ // our wierd countries/langs etc..
+ if (isset($cfg['add_' . $type][$k])) {
+ return $cfg['add_' . $type][$k];
+
+ }
+
return $ret;