}
- function get($path)
+ function get($module, $opts = Array())
{
- if (!empty($path)) {
+ if (!empty($module)) {
$this->init();
- // output the translations strings file..
- list($module, $lang) = explode('/',$path);
+ //DB_DataObject::debugLevel(1);
+ require_once 'Services/JSON.php';
+ $d = DB_DataObject::factory('translations');
+ $d->module = $module;
+ $d->selectAdd();
+ $d->selectAdd('distinct(tlang) as tlang');
+ header('Content-type: text/javascript');
+ $langs= $d->fetchAll('tlang');
+ foreach($langs as $lang) {
+ // output the translations strings file..
- $this->loadOriginalStrings($module);
-
- $data = $this->loadTranslateDB($lang,$module);
-
- $j = new Services_JSON();
-
- echo $j->stringify($data, null, 4);
+
+ $this->loadOriginalStrings($module);
+
+ $data = $this->loadTranslateDB($lang,$module);
+
+ $j = new Services_JSON();
+ echo "_T.{$lang}= Roo.apply( _T.{$lang} || { }, " . $j->stringify($data, null, 4) . ");\n";
+
+ }
exit;
}
}
- function post()
+ function post($v)
{
$d = DB_DataObject::factory('translations');
$d->module = $module;
$d->tlang = $lang;
-
+ $d->whereAdd('LENGTH(tval) > 0');
$ret = array();
if ($d->count()) {
if (!isset($this->originalKeys[$k])) {
continue;
}
+
// it's current..
$this->saveTranslateDB($lang, $module, $this->originalKeys[$k], $k, $v);
$ret[$k] = $v;