public function actionAdmin() { $this->rememberPage(); $model = new TranslateMessage('search'); $model->setRememberScenario('translate_remember'); $this->render('admin', array('model' => $model)); }
public function actionCreate() { $model = new FormDesigner(); $model->scenario = 'advanced'; $model->type = FormDesigner::TYPE_TEXT; $translate = new TranslateMessage(); if (isset($_POST['FormDesigner'])) { $model->attributes = $_POST['FormDesigner']; if ($model->validate()) { // magic begin $this->fieldName = translit($model->getStrByLang('label'), '_', true); $this->fieldName = substr($this->fieldName, 0, 12); if ($this->setFieldInTable($_POST['FormDesigner']['type'])) { $model->field = $this->fieldName; $translate->attributes = $_POST['TranslateMessage']; $translate->category = 'common'; $translate->message = 'Search by ' . $this->fieldName; if ($translate->save()) { $model->save(); Yii::app()->cache->flush(); Yii::app()->user->setFlash('success', tt('The new field is successfully created.')); $this->redirect(Yii::app()->createUrl('/formdesigner/backend/main/admin')); } } else { $model->addError('', tt('Failed to create field')); } } } $this->render('create', array('model' => $model, 'translate' => $translate)); }
static function handleMissingTranslation($event) { if (in_array($event->category, array('YiiDebug.yii-debug-toolbar', 'yii-debug-toolbar'))) { return false; } TranslateMessage::missingTranslation($event->category, $event->message); }
public function actionCreate() { $model = new Currency(); $translate = new TranslateMessage(); if (isset($_POST['Currency'])) { $model->attributes = $_POST['Currency']; if ($model->validate()) { $translate->attributes = $_POST['TranslateMessage']; $translate->category = 'module_currency'; $translate->message = $model->char_code . "_translate"; if ($translate->save()) { $model->save(); Yii::app()->cache->flush(); Yii::app()->user->setFlash('success', tc('Success')); $this->redirect(Yii::app()->createUrl('/currency/backend/main/admin')); } } } $this->render('create', array('model' => $model, 'translate' => $translate)); }
public static function getStatusArray() { if (!isset(self::$_statusArray)) { self::$_statusArray = array(self::STATUS_NO_ERROR => tt('Translated'), self::STATUS_ERROR_NO_TRANSLATE => tt('Not translated')); } return self::$_statusArray; }
public function getTranslateModel() { tt($this->char_code . "_translate", 'currency'); $model = TranslateMessage::model()->findByAttributes(array('category' => 'module_currency', 'message' => $this->char_code . "_translate")); return $model; }
<?php $this->pageTitle = Yii::app()->name . ' - ' . tt('Manage lang messages', 'translateMessage'); $this->menu = array(array('label' => tt('Add message'), 'url' => array('create'))); $this->adminTitle = tt('Manage lang messages', 'translateMessage'); $this->widget('CustomGridView', array('id' => 'translate-message-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'afterAjaxUpdate' => 'function(){$("a[rel=\'tooltip\']").tooltip(); $("div.tooltip-arrow").remove(); $("div.tooltip-inner").remove();}', 'columns' => array(array('name' => 'status', 'filter' => TranslateMessage::getStatusArray(), 'type' => 'raw', 'value' => '$data->getStatusHtml()', 'htmlOptions' => array('class' => 'width120')), array('name' => 'category', 'filter' => TranslateMessage::getCategoryFilter(), 'htmlOptions' => array('class' => 'width200')), 'message', 'translation', array('class' => 'bootstrap.widgets.TbButtonColumn', 'deleteConfirmation' => tc('Are you sure you want to delete this item?'), 'template' => '{update}{delete}'))));
public function getTranslateModel() { if ($this->type == self::TYPE_DEFAULT || $this->isNewRecord) { return NULL; } tc('Search by ' . $this->field); $model = TranslateMessage::model()->findByAttributes(array('category' => 'common', 'message' => 'Search by ' . $this->field)); return $model; }