$opts = empty($ff->Pman_Core_I18N) ? (empty($ff->Pman_I18N) ? array() : $ff->Pman_I18N) : $ff->Pman_Core_I18N;
- $i = DB_DataObject::Factory('I18n');
}
+ function guessUsersLanguage() {
+
+ $lang = !$this->authUser || empty($this->authUser->lang ) ? 'en' : $this->authUser->lang;
+
+ /// verify the selected language..
+ $i = DB_DataObject::Factory('I18n');
+ $i->ltype = 'l'; // string(1) not_null multiple_key
+ $i->lkey = $lang; // string(8) not_null
+ if (!$i->count()) {
+ $this->jerr('invalid lang configured: ' . $lang);
+ }
+
+
+ return explode('_', $lang);
+ }
function get($s ='')
{
-
$i = DB_DataObject::Factory('I18n');
$i->buildDb();
+ $lbits = $this->guessUsersLanguage();
+
+
+ $i = DB_DataObject::Factory('I18n');
+
+ switch($s) {
+ case 'Lang':
+ $i->ltype = 'l';
+ $i->applyFilters($_REQUEST, $this->authUser, $this);
+ $this->jdata($i->toTransList('l', $lbits[0]));
+ break;
+
+ case 'Country':
+ $i->ltype = 'l';
+ $i->applyFilters($_REQUEST, $this->authUser, $this);
+ $this->jdata($i->toTransList('l', $lbits[0]));
+
+ $ret = $this->getList('c', $lbits[0],empty($_REQUEST['filter']) ? false : $_REQUEST['filter']);
+ break;
+
+ case 'Currency':
+ $i->ltype = 'l';
+ $i->applyFilters($_REQUEST, $this->authUser, $this);
+ $this->jdata($i->toTransList('l', $lbits[0]));
+ break;
+
+
+ }
+
+
$i = DB_DataObject::Factory('I18n');
$cfg = $i->cfg();