Exemplo n.º 1
0
function run_create_translation($args, $opts)
{
    G::LoadSystem('inputfilter');
    $filter = new InputFilter();
    $opts = $filter->xssFilterHard($opts);
    $args = $filter->xssFilterHard($args);
    $rootDir = realpath(__DIR__."/../../../../");
    $app = new Maveriks\WebApplication();
    $app->setRootDir($rootDir);
    $loadConstants = false;

    $workspaces = get_workspaces_from_args($args);
    $lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';

    $translation = new Translation();
    CLI::logging("Updating labels Mafe ...\n");
    foreach ($workspaces as $workspace) {
        try {
            echo "Updating labels for workspace " . pakeColor::colorize($workspace->name, "INFO") . "\n";
            $translation->generateTransaltionMafe($lang);
        } catch (Exception $e) {
            echo "Errors upgrading labels for workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n";
        }
    }

    CLI::logging("Create successful\n");

}
 public function storeTranslation($data, $locale = null, $options = [])
 {
     if (!$locale) {
         $locale = config('app.locale');
     }
     $translation = new Translation();
     return $translation->store($this, $locale, $data, $options);
 }
 public static function translate($key_phrase)
 {
     $tTable = new Translation();
     $select = $tTable->select()->where("key_phrase = '{$key_phrase}'");
     $db_phrase = $tTable->fetchRow($select)->phrase;
     if (ITechTranslate::getLocale() == 'en_EN.UTF-8') {
         return $db_phrase;
     } else {
         return t($db_phrase);
     }
 }
Exemplo n.º 4
0
 public function run()
 {
     if (Yii::app()->request->getPost('translate')) {
         //переклади в таблиці translation
         $model = new Translation();
         $model->object = Yii::app()->request->getPost('table');
         $row = Yii::app()->request->getPost('translate');
         $subject = Yii::app()->request->getPost('column');
         $exist = $model->findByPk(Yii::app()->request->getPost('tr_id'));
         if ($exist) {
             $compare = $model->findByAttributes(array('translate' => $row));
             if ($compare) {
                 echo CJSON::encode(array('status' => 'error'));
                 Yii::app()->end();
             }
             $model = $exist;
         }
         $model->subject = $subject;
         $model->row_id = Yii::app()->request->getPost('row_id');
         $model->lan_id = Yii::app()->request->getPost('lan_id');
         $model->translate = Yii::app()->request->getPost('translate');
         if ($lastId = $model->Add()) {
             echo CJSON::encode(array('status' => 'success', 'tr_id' => $lastId));
             Yii::app()->end();
         }
     } else {
         //перекладаєм оригінальний текст
         $table = ucfirst(Yii::app()->request->getPost('table'));
         $object = new $table();
         $subject = Yii::app()->request->getPost('column');
         $row = Yii::app()->request->getPost('row');
         $row_id = Yii::app()->request->getPost('row_id');
         $object->setAttribute($subject, $row);
         $exist = $object->findByPk($row_id);
         if ($exist) {
             $compare = $object->findByAttributes(array($subject => $row));
             if ($compare) {
                 echo CJSON::encode(array('status' => 'error'));
                 Yii::app()->end();
             }
             $object = $exist;
         } else {
             echo CJSON::encode(array('status' => 'error'));
         }
         $object->{$subject} = Yii::app()->request->getPost('row');
         if ($object->Add()) {
             echo CJSON::encode(array('status' => 'success'));
             Yii::app()->end();
         }
     }
     echo CJSON::encode(array('status' => 'error'));
     Yii::app()->end();
 }
 public function testConstruct()
 {
     try {
         $dataObject = new Translation(array('invalid' => 'foo'));
         $this->fail('Expected \\UnexpectedValueException exception not thrown.');
     } catch (\UnexpectedValueException $e) {
     }
     $dataObject = new Translation(array('translatedText' => 'foo'));
     $this->assertEquals($dataObject->getTranslatedText(), 'foo');
     $this->assertNull($dataObject->getDetectedSourceLanguage());
     $dataObject = new Translation(array('translatedText' => 'foo', 'detectedSourceLanguage' => 'bar'));
     $this->assertEquals($dataObject->getTranslatedText(), 'foo');
     $this->assertEquals($dataObject->getDetectedSourceLanguage(), 'bar');
 }
Exemplo n.º 6
0
 function get_Schedule($id, $ident)
 {
     global $globalDebug;
     // Get schedule here, so it's done only one time
     $Connection = new Connection();
     $dbc = $Connection->db;
     $Spotter = new Spotter($dbc);
     $Schedule = new Schedule($dbc);
     $Translation = new Translation($dbc);
     $operator = $Spotter->getOperator($ident);
     if ($Schedule->checkSchedule($operator) == 0) {
         $operator = $Translation->checkTranslation($ident);
         if ($Schedule->checkSchedule($operator) == 0) {
             $schedule = $Schedule->fetchSchedule($operator);
             if (count($schedule) > 0) {
                 if ($globalDebug) {
                     echo "-> Schedule info for " . $operator . " (" . $ident . ")\n";
                 }
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime']));
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime']));
                 // FIXME : Check if route schedule = route from DB
                 if ($schedule['DepartureAirportIATA'] != '') {
                     if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) {
                         $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
                         if ($airport_icao != '') {
                             $this->all_flights[$id]['departure_airport'] = $airport_icao;
                             if ($globalDebug) {
                                 echo "-> Change departure airport to " . $airport_icao . " for " . $ident . "\n";
                             }
                         }
                     }
                 }
                 if ($schedule['ArrivalAirportIATA'] != '') {
                     if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) {
                         $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
                         if ($airport_icao != '') {
                             $this->all_flights[$id]['arrival_airport'] = $airport_icao;
                             if ($globalDebug) {
                                 echo "-> Change arrival airport to " . $airport_icao . " for " . $ident . "\n";
                             }
                         }
                     }
                 }
                 $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']);
             }
         }
     }
     //$Connection->db = null;
 }
Exemplo n.º 7
0
 public function __construct($door = "")
 {
     //iniciando a config básico, a menos que exita outro config, este vai ser o que vai ficar valendo
     $domain = Navigation::getURIDomain();
     if ($door) {
         //use em $door ":8080" por exemplo
         $domain = str_replace($door, "", $domain);
     }
     include "configs/" . $domain . "/config.php";
     //se não foi passado algum locale na url apos o nome do site faz um redirect passando o locale padrão
     $folders_array = Navigation::getURI(Config::getAliasFolder(), Navigation::URI_RETURN_TYPE_ARRAY);
     $locale = Config::getLocale();
     Translation::setLocale($locale);
     //inicia e pega resultado da controller
     $this->HttpResult = $this->getControllerResult();
     //agora verifica que tipo de retorno esperado e chama a view, se for o caso
     $ignore_name = Config::getAliasFolder();
     if (Config::getLocale()) {
         $ignore_name .= "/" . Config::getLocale();
     }
     //url com trata com regras de rota
     $url = explode("/", Config::rewriteUrl(Navigation::getURI($ignore_name, Navigation::URI_RETURN_TYPE_STRING)));
     $retornoDaView = self::searchFile($url, Config::getFolderView());
     if ($retornoDaView->success) {
         //echo Debug::li("retornoDaView:".$retornoDaView->urlToInclude);
         $this->view = $retornoDaView->urlToInclude;
     } else {
         $this->view = Config::getFolderView() . "/index.php";
     }
 }
Exemplo n.º 8
0
 public static function newInstance($install = false)
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self($install);
     }
     return self::$instance;
 }
 public function initialize($session, $force = false)
 {
     if (!$session->has('translateEngine') || $session->get('translateEngine') == null || $force) {
         $this->translations = \Translation::find("INSTR(lang,'" . $this->language . "')>0");
         $session->set('translateEngine', $this);
     }
 }
Exemplo n.º 10
0
 public static function newInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
/**
 * Translate a string
 */
function smarty_block_translation($params, $content, $smarty, &$repeat)
{
    return $content;
    if ($content !== null) {
        return Translation::translate($content, $smarty->tpl_vars['env']->value['translation']);
    }
}
Exemplo n.º 12
0
 public function __construct()
 {
     //iniciando a config básico, a menos que exita outro config, este vai ser o que vai ficar valendo
     include "configs/" . str_replace(":8888", "", Navigation::getURIDomain()) . "/config.php";
     //se não foi passado algum locale na url apos o nome do site faz um redirect passando o locale padrão
     //echo Debug::li(Config::getAliasFolder());
     $folders_array = Navigation::getURI(Config::getAliasFolder(), Navigation::URI_RETURN_TYPE_ARRAY);
     //echo Debug::li(Config::getRootApplication());
     //$folders_array = Navigation::getURI(Config::getAliasFolder(), Navigation::URI_RETURN_TYPE_ARRAY);
     $locale = Config::getLocale();
     Translation::setLocale($locale);
     //inicia e pega resultado da controller
     $this->HttpResult = $this->getControllerResult();
     //agora verifica que tipo de retorno esperado e chama a view, se for o caso
     $ignore_name = Config::getAliasFolder();
     if (Config::getLocale()) {
         $ignore_name .= "/" . Config::getLocale();
     }
     //url com trata com regras de rota
     $url = explode("/", Config::rewriteUrl(Navigation::getURI($ignore_name, Navigation::URI_RETURN_TYPE_STRING)));
     $retornoDaView = self::searchFile($url, Config::getFolderView());
     //Navigation::searchFileOrFolder(Config::getRootApplication()."/".Config::getLocale(), Config::getFolderView(), Navigation::SEARCH_FILE_MODE_FILE);
     //echo Debug::li("retornoDaView");
     //Debug::print_r($retornoDaView);
     if ($retornoDaView->success) {
         //echo Debug::li("retornoDaView:".$retornoDaView->urlToInclude);
         $this->view = $retornoDaView->urlToInclude;
     } else {
         $this->view = Config::getFolderView() . "/index.php";
     }
     //exit();
     //Debug::print_r("[SEARCH_FILE_MODE_CLASS_AND_METHOD]:".Navigation::searchFileOrFolder(Config::FOLDER_ROOT_APPLICATION, "view/democrart/", Navigation::SEARCH_FILE_MODE_CLASS_AND_METHOD, "", TRUE));
 }
Exemplo n.º 13
0
 public function showLangModal()
 {
     $language = Yii::app()->params['language'];
     $this->beginWidget('bootstrap.widgets.TbModal', array('id' => $this->modalId, 'htmlOptions' => array('style' => 'margin-top:-200px;', 'backdrop' => 'static')));
     echo "<div class=\"modal-header\">\n                <h4 style=\"width:30%;display: inline-block;\">翻译</h4> \n                <span id='" . $this->modalId . "message' style=\"margin-left:30px;color:red;\"></span>\n            </div>";
     echo "<div id='" . $this->modalId . "ModalBody' class=\"modal-body\" style=\"text-align:center\">";
     $tableName = $this->model->tableName();
     $attribute = $this->attribute;
     echo CHtml::hiddenField('tableName', $tableName);
     echo CHtml::hiddenField('attribute', $attribute);
     $pk = $this->model->primaryKey;
     echo CHtml::activeHiddenField($this->model, $this->model->pk, array('name' => 'pk'));
     $result = Translation::model()->find('model=:tableName and pk=:pk and attribute=:attribute', array(':tableName' => $tableName, ':pk' => $pk, ':attribute' => $attribute));
     $data = json_decode($result->data);
     foreach ($language as $key => $value) {
         if (strtolower($key) == 'zh_cn') {
             continue;
         }
         echo "<div><span style='width:80px !important;display: inline-block;'>" . $value . '</span>' . CHtml::textField($key, $data->{$key}) . "</div>";
     }
     echo "</div>";
     echo "<div class=\"modal-footer\" style=\"text-align: center;\">";
     $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'button', 'type' => 'info', 'label' => '保存', 'htmlOptions' => array('id' => $this->modalId . 'save')));
     echo "&nbsp;";
     $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'button', 'label' => '取消', 'htmlOptions' => array("data-dismiss" => "modal", 'id' => $this->modalId . 'back')));
     echo "</div>";
     $this->endWidget();
 }
Exemplo n.º 14
0
 public function __construct()
 {
     if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
     } else {
         $lang = "en";
     }
     switch ($lang) {
         case "de":
             include PATH . "inc/language_de.php";
             Translation::$languageDict = $_;
             unset($_);
             break;
         case "en":
             include PATH . "inc/language_en.php";
             Translation::$languageDict = $_;
             unset($_);
             break;
         default:
             include PATH . "inc/language_en.php";
             Translation::$languageDict = $_;
             unset($_);
             break;
     }
 }
Exemplo n.º 15
0
/**
 * Retrieve the singular or plural translation of the string.
 *
 * @since 2.2
 *
 * @param string $single_key
 * @param string $plural_key
 * @param int $count
 * @param string $domain
 * @return string
 */
function _n($single_key, $plural_key, $count, $domain = 'core')
{
    $gt = Translation::newInstance()->_get($domain);
    if (!$gt) {
        return $key;
    }
    return $gt->ngettext($single_key, $plural_key, $count);
}
Exemplo n.º 16
0
 public function __construct()
 {
     parent::__construct();
     $this->http_header->setTitle(Translation::text("A maior galeria de arte do Brasil em edição limitada, numerada e assinada de quadros, gravuras e fotografias. Decore com arte."));
     $this->http_header->setDescription(Translation::text("A maior galeria de arte do Brasil em edição limitada, numerada e assinada de quadros, gravuras e fotografias. Decore com arte."));
     $this->http_header->getKeywords(Translation::text("quadros gravuras,quadros online,venda quadros,desenhos,venda de quadros,reproduções,artes,comprar gravuras,comprar quadros,gravura,gravuras,loja quadros,quadros,decoração de interiores quartos,decoração de ambientes interiores,decoração de interiores salas,arte moderna,quadros decorativos,papel de parede decoração de interiores,dicas de decoração para quartos,papel de parede para quarto de bebe,papel de parede decoração quarto,lojas decoração interiores,decoração de paredes interiores,revista de decoração de interiores,fotos decoração de sala,dicas de decoração de interiores,decoração design de interiores,pintura em tela a oleo,pintura em tela,objetos de decoração para sala,quadros de parede,quarto de bebe,gravuras para quadros,adesivos decorativos de parede,papel de parede,papel de parede para quarto,quartos de bebe decorados,galerias de arte sp,molduras para quadros,sites de decoração de interiores,galeria de arte virtual,galerias de arte rio de janeiro,ideias decoração interiores,site de decoração de casas,adesivos de parede,decoração de interiores cozinha,decoração de quarto infantil menina,quadros em mdf,adesivos decoração interiores,quadros abstratos modernos,quadros pintura abstrata,decoração parede quarto,quadros para quarto de bebe,decoração interiores sala estar,decoração pintura parede,quadros pintura em tela,decoração festa junina infantil,adesivos de parede infantil,papel de parede para quarto infantil,quadros para quarto de casal,quarto de menina,galeria arte quadros,pintura quarto de bebe,quadro de fotos,papel de parede infantil,moveis para quarto de bebe,decoração de interiores banheiros,objetos de decoração de interiores,decoração de quarto de bebe com papel de parede,fotos de decoração de cozinha,adesivos de parede para quarto de bebe,\r\ndecoração de ambientes casa,cortinas para quarto de bebe,quadro de avisos,loja de quadros,decoração cozinhas planejadas,dicas de decoração de sala,decoração textura parede,decoração parede sala,quartos decorados,site de decoração de quartos,objetos de decoração para quarto,decoração de interiores de apartamentos,pintura em tela abstrato,quadros pintados,cozinha americana decoração,rei dos quadros,adesivos de parede tok stok,quarto de bebe menina,moveis e decoração de casas,adesivos decorativos,pintura de parede,quarto infantil,festa infantil,fotos de decoração de banheiros,papel de parede decorativo,quadros para decoração de sala,quadros decorativos para sala"));
     $this->arrayProducts = array();
 }
Exemplo n.º 17
0
 public static function setLocale($new_locale = '')
 {
     if (!is_string($new_locale)) {
         $new_locale = Config::DEFAULT_LOCALE;
     }
     self::$locale = $new_locale;
     self::loadMOFiles();
     self::$def = self::$locale;
 }
Exemplo n.º 18
0
/**
 * Retrieve the singular or plural translation of the string.
 *
 * @since 2.2
 *
 * @param string $single_key
 * @param string $plural_key
 * @param int $count
 * @param string $domain
 * @return string
 */
function _n($single_key, $plural_key, $count, $domain = 'core')
{
    $gt = Translation::newInstance()->_get($domain);
    if (!$gt) {
        return $key;
    }
    $string = $gt->ngettext($single_key, $plural_key, $count);
    return osc_apply_filter('ngettext', $string);
}
 public function save($data)
 {
     $transaction = $this->beginTransaction();
     try {
         if (!$this->isPersistent()) {
             $entry = new Entry();
             $entry->newEntry($this->getEntry());
             $translation = new Translation();
             $translation->newResource($this->getNameEntity1());
             $translation->newResource($this->getNameEntity2());
         }
         parent::save();
         $transaction->commit();
     } catch (\Exception $e) {
         $transaction->rollback();
         throw new \Exception($e->getMessage());
     }
 }
 /**
  * @return Translation[]
  */
 public function getAllTranslations()
 {
     $dbr = Database::getConnection(DB_SLAVE);
     $rows = $dbr->select(array('cx_translations', 'cx_translators'), '*', array('translator_translation_id = translation_id', 'translator_user_id' => $this->getGlobalUserId()), __METHOD__, array('ORDER BY' => 'translation_last_updated_timestamp DESC'));
     $result = array();
     foreach ($rows as $row) {
         $result[] = Translation::newFromRow($row);
     }
     return $result;
 }
Exemplo n.º 21
0
 /**
  * m�todo getInstance()
  * retorna a �nica inst�ncia de TTranslation
  */
 public static function getInstance($lang = 'pt_BR')
 {
     // se n�o existe inst�ncia ainda
     if (empty(self::$instance)) {
         // instancia um objeto
         self::$instance = new Translation($lang);
     }
     // retorna a inst�ncia
     return self::$instance;
 }
Exemplo n.º 22
0
 /**
  * execute
  *
  * Exclude irrelevant files. If it's a vendor or a test file - keep that stuff out of the
  * pot files. also, if it's in the webroot it's either not cake or just the standard text
  * in the index/test.php files which is irrelevant
  *
  * Also set the default domain based on the config for the translations plugin
  *
  * @return void
  */
 public function execute()
 {
     $config = Translation::config();
     $this->_defaultDomain = $config['domain'];
     $this->params['ignore-model-validation'] = false;
     $this->_exclude[] = 'Test';
     $this->_exclude[] = 'Vendor';
     $this->_exclude[] = 'webroot';
     parent::execute();
 }
 public function testSingleItem()
 {
     Translation::update('Model.1.field', 'Updated foo');
     Translation::update('Model.1.another_field', 'Updated bar');
     $in = array(array('Model' => array('id' => 1, 'field' => 'foo', 'another_field' => 'bar'), 'AnotherModel' => array('id' => 2, 'field' => 'foo', 'another_field' => 'bar')));
     $iterator = new TranslateInjector($in, array('Model.field', 'Model.another_field'), array('modelAlias' => 'Model', 'modelName' => 'Model'));
     $data = iterator_to_array($iterator);
     $expected = array(array('Model' => array('id' => 1, 'field' => 'Updated foo', 'another_field' => 'Updated bar'), 'AnotherModel' => array('id' => 2, 'field' => 'foo', 'another_field' => 'bar')));
     $this->assertSame($expected, $data);
 }
Exemplo n.º 24
0
function _e($key, $domain = 'core')
{
    $gt = Translation::newInstance()->_get($domain);
    if (!$gt) {
        echo $key;
        return '';
    }
    echo $gt->translate($key);
    return '';
}
Exemplo n.º 25
0
 public static function get($key)
 {
     $string = self::$strings[$key];
     if (!isset($string)) {
         if (!isset(self::$stringsEN)) {
             self::$stringsEN = parent::getStrings(substr(__CLASS__, 0, strlen(__CLASS__) - 1), parent::LANG_EN);
         }
         return self::$stringsEN[$key];
     }
     return $string;
 }
Exemplo n.º 26
0
 /**
  *
  */
 public static function init()
 {
     static::$settings = array('sorter' => array(), 'listing' => array(), 'translation' => array());
     if (class_exists('Chansig\\DirectoryIndex\\Settings')) {
         static::$settings = array_replace_recursive(static::$settings, Settings::getSettings());
     }
     Listing::setup(static::$settings['listing']);
     Sorter::setup(static::$settings['sorter']);
     Translation::setup(static::$settings['sorter']);
     Theme::setup(static::$settings['sorter']);
 }
Exemplo n.º 27
0
 /**
  * parse
  *
  * @throws \Exception if the file cannot be loaded
  * @param string $file
  * @param array $defaults
  * @return array
  */
 public static function parse($file, $defaults = array())
 {
     $doc = new DomDocument();
     if (!$doc->load($file)) {
         throw new \Exception("File could not be loaded");
     }
     $array = self::_parsePlist($doc);
     $defaults += Translation::config();
     $parsed = array();
     self::_flatten($array, $parsed);
     return self::_parseArray($parsed, $defaults);
 }
Exemplo n.º 28
0
 function getTranslation($category = LC_MESSAGES, $locale = false)
 {
     $locale = $locale ?: self::$current_locale ?: self::setLocale(LC_MESSAGES, 0);
     if (isset($this->l10n[$locale])) {
         return $this->l10n[$locale];
     }
     if ($locale == 'en_US') {
         $this->l10n[$locale] = new Translation(null);
     } else {
         // get the current locale
         $bound_path = @$this->path ?: './';
         $subpath = self::$LC_CATEGORIES[$category] . '/' . $this->domain . '.mo.php';
         // APC short-circuit (if supported)
         $key = sha1($locale . ':lang:' . $subpath);
         if ($T = Translation::resurrect($key)) {
             return $this->l10n[$locale] = $T;
         }
         $locale_names = self::get_list_of_locales($locale);
         $input = null;
         foreach ($locale_names as $T) {
             if (substr($bound_path, 7) != 'phar://') {
                 $phar_path = 'phar://' . $bound_path . $T . ".phar/" . $subpath;
                 if (file_exists($phar_path)) {
                     $input = $phar_path;
                     break;
                 }
             }
             $full_path = $bound_path . $T . "/" . $subpath;
             if (file_exists($full_path)) {
                 $input = $full_path;
                 break;
             }
         }
         // TODO: Handle charset hint from the environment
         $this->l10n[$locale] = $T = new Translation($input);
         $T->cache($key);
     }
     return $this->l10n[$locale];
 }
Exemplo n.º 29
0
 public function __construct($attributes)
 {
     parent::__construct($attributes);
     if (!isset($this->attributes['products_source_field']) || !$this->attributes['products_source_field'] instanceof ProductSelect) {
         throw new Exception("Source field (attribute: products_source_field) not set for field '{$this->attributes['name']}'.");
     }
     $this->attributes['products_source_field_name'] = $this->attributes['products_source_field']->getName();
     $this->attributes['vat_values'] = App::getModel('vat/vat')->getVATAll();
     $this->attributes['prefixes'] = array(Translation::get('TXT_PRICE_NET'), Translation::get('TXT_PRICE_GROSS'));
     $this->_jsFunction = 'LoadProductDataForAggregation_' . $this->_id;
     $this->attributes['jsfunction'] = 'xajax_' . $this->_jsFunction;
     App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsFunction, $this, 'loadProductData'));
 }
Exemplo n.º 30
0
 /**
  * Export translations to the specified path
  * Currently supports:
  * 	json
  *
  * @throws \Exception if the file specified is not writable
  */
 public function main()
 {
     $file = $this->args[0];
     foreach ($this->params as $key => $val) {
         $this->_settings[$key] = $val;
     }
     $return = Translation::export($file, $this->_settings);
     if ($return['success']) {
         $this->out(sprintf('Wrote %d translations', $return['count']));
     } else {
         $this->out(sprintf('Error creating %s', $file));
     }
     $this->out('Done');
 }