pgaultier / sweelix-yii2-plupload

Sweelix Yii2 plupload extension - easy asynchronous file uploads
Other
17 stars 9 forks source link

Missing translations #2

Open demogorgorn opened 10 years ago

demogorgorn commented 10 years ago

I've tried to install again on clean project to test previous bug and received new error exception message.

Here is the error log (Sorry for big text but maybe it will be useful):


Invalid Configuration – yii\base\InvalidConfigException
Unable to locate message source for category 'sweelix'.
• 1. in D:\OpenServer\domains\localhost\baby\vendor\yiisoft\yii2\i18n\I18N.phpat line199
190191192193194195196197198199200201
                $source = $this->translations['*'];
                if ($source instanceof MessageSource) {
                    return $source;
                } else {
                    return $this->translations[$category] = $this->translations['*'] = Yii::createObject($source);
                }
            }
        }

        throw new InvalidConfigException("Unable to locate message source for category '$category'.");
    }
}
• 2. in D:\OpenServer\domains\localhost\baby\vendor\yiisoft\yii2\i18n\I18N.php – yii\i18n\I18N::getMessageSource('sweelix')at line87
• 3. in D:\OpenServer\domains\localhost\baby\vendor\yiisoft\yii2\BaseYii.php – yii\i18n\I18N::translate('sweelix', 'Browse ...', [], 'ru')at line496
• 4. in D:\OpenServer\domains\localhost\baby\vendor\sweelix\yii2-plupload\src\traits\Plupload.php – yii\BaseYii::t('sweelix', 'Browse ...')at line260
254255256257258259260261262263264265266
            }
        }
        if (isset($options['content']) == true) {
            $content = $options['content'];
            unset($options['content']);
        } else {
            $content = Yii::t('sweelix', 'Browse ...');
        }

        $js = 'jQuery(\'#'.$options['id'].'\').asyncUpload('.Json::encode($config).');';
        unset($options['uploadOptions']);
        unset($options['value']);

• 5. in D:\OpenServer\domains\localhost\baby\vendor\sweelix\yii2-plupload\src\traits\Plupload.php – app\components\Html::renderAsyncInput(null, ['name' => 'filname', 'id' => 'filname'], ['runtimes' => 'html5, html4', 'ui' => true, 'multiSelection' => false, 'url' => '/baby/web/index.php/questions/ic...', ...])at line205
199200201202203204205206207208209210211
                // get first value in case we are not multi
                $value = array_pop($value);
            }
        }

        $config = static::prepareAsyncInput($options);
        return static::renderAsyncInput($value, $options, $config);
    }

    /**
     * Build the input file and render it
     *
     * @param mixed $values  uploaded / files
• 6. in D:\OpenServer\domains\localhost\baby\modules\questions\views\icons\_form.php – app\components\Html::asyncInput('filname', null, ['config' => ['ui' => true, 'auto' => true]])at line43
37383940414243444546474849
    
[ 'ui' => true, 'auto' => true, ]]); ?>
isNewRecord ? Yii::t('olegmart\questions','Create') : Yii::t('olegmart\questions','Update'), ['class' => $model->isNewRecord ? 'uk-button uk-button-success' : 'uk-button uk-button-primary']) ?>
• 7. in D:\OpenServer\domains\localhost\baby\vendor\yiisoft\yii2\base\View.php – require('D:\OpenServer\domains\localhost\...')at line313 • 8. in D:\OpenServer\domains\localhost\baby\vendor\yiisoft\yii2\base\View.php – yii\base\View::renderPhpFile('D:\OpenServer\domains\localhost\...', ['model' => app\modules\questions\models\Icons])at line245 • 9. in D:\OpenServer\domains\localhost\baby\vendor\yiisoft\yii2\base\View.php – yii\base\View::renderFile('D:\OpenServer\domains\localhost\...', ['model' => app\modules\questions\models\Icons], null)at line147 • 10. in D:\OpenServer\domains\localhost\baby\modules\questions\views\icons\create.php – yii\base\View::render('_form', ['model' => app\modules\questions\models\Icons])at line20 141516171819202122

title) ?>

render('_form', [ 'model' => $model, ]) ?>
• 11. in D:\OpenServer\domains\localhost\baby\vendor\yiisoft\yii2\base\View.php – require('D:\OpenServer\domains\localhost\...')at line313 • 12. in D:\OpenServer\domains\localhost\baby\vendor\yiisoft\yii2\base\View.php – yii\base\View::renderPhpFile('D:\OpenServer\domains\localhost\...', ['model' => app\modules\questions\models\Icons])at line245 • 13. in D:\OpenServer\domains\localhost\baby\vendor\yiisoft\yii2\base\View.php – yii\base\View::renderFile('D:\OpenServer\domains\localhost\...', ['model' => app\modules\questions\models\Icons], app\modules\questions\controllers\IconsController)at line147 • 14. in D:\OpenServer\domains\localhost\baby\vendor\yiisoft\yii2\base\Controller.php – yii\base\View::render('create', ['model' => app\modules\questions\models\Icons], app\modules\questions\controllers\IconsController)at line362 • 15. in D:\OpenServer\domains\localhost\baby\modules\questions\controllers\IconsController.php – yii\base\Controller::render('create', ['model' => app\modules\questions\models\Icons])at line70 64656667686970717273747576 if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', [ 'model' => $model, ]); } } /** * Updates an existing Icons model. * If update is successful, the browser will be redirected to the 'view' page. • 16. app\modules\questions\controllers\IconsController::actionCreate() • 17. in D:\OpenServer\domains\localhost\baby\vendor\yiisoft\yii2\base\InlineAction.php – call_user_func_array([app\modules\questions\controllers\IconsController, 'actionCreate'], [])at line54 • 18. in D:\OpenServer\domains\localhost\baby\vendor\yiisoft\yii2\base\Controller.php – yii\base\InlineAction::runWithParams([])at line147 • 19. in D:\OpenServer\domains\localhost\baby\vendor\yiisoft\yii2\base\Module.php – yii\base\Controller::runAction('create', [])at line423 • 20. in D:\OpenServer\domains\localhost\baby\vendor\yiisoft\yii2\web\Application.php – yii\base\Module::runAction('questions/icons/create', [])at line82 • 21. in D:\OpenServer\domains\localhost\baby\vendor\yiisoft\yii2\base\Application.php – yii\web\Application::handleRequest(yii\web\Request)at line354 • 22. in D:\OpenServer\domains\localhost\baby\web\index.php – yii\base\Application::run()at line12 6789101112 require(__DIR__ . '/../vendor/autoload.php'); require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); $config = require(__DIR__ . '/../config/web.php'); (new yii\web\Application($config))->run(); $_SERVER = array ( 'HTTP_HOST' => 'localhost', 'HTTP_CONNECTION' => 'keep-alive', 'HTTP_CACHE_CONTROL' => 'max-age=0', 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36 OPR/20.0.1387.59 (Edition Next)', 'HTTP_REFERER' => 'http://localhost/baby/web/index.php/questions/icons/index', 'HTTP_ACCEPT_ENCODING' => 'gzip,deflate,lzma,sdch', 'HTTP_ACCEPT_LANGUAGE' => 'ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4', 'HTTP_COOKIE' => '_csrf=06500e71bfab15d3659d43db530cef4735914a5e997123013ad68983033cdabcs%3A32%3A%225Bp5PA9OLMxfN2az535oZWmvyX3iCpPC%22%3B; PHPSESSID=2rqs27s8b3mohcn00c6tcpnha4; _identity=ae01722b097ab814feed4d6735a15a23b5e5673c22514318637190dc2d8ae9e4s%3A28%3A%22%5B%22100%22%2C%22test100key%22%2C2592000%5D%22%3B', 'PATH' => 'D:\\OpenServer\\modules\\php\\PHP-5.4.22\\ext;D:\\OpenServer\\modules\\php\\PHP-5.4.22\\pear;D:\\OpenServer\\modules\\imagemagick;D:\\OpenServer\\modules\\php\\PHP-5.4.22;D:\\OpenServer\\modules\\database\\MySQL-5.5.35\\bin;D:\\OpenServer\\modules\\http\\Apache-2.2.26\\bin;D:\\OpenServer\\modules\\http\\Apache-2.2.26;D:\\OpenServer\\modules\\wget\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\system32\\Wbem', 'SystemRoot' => 'C:\\WINDOWS', 'COMSPEC' => 'C:\\WINDOWS\\system32\\cmd.exe', 'PATHEXT' => '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH', 'WINDIR' => 'C:\\WINDOWS', 'SERVER_SIGNATURE' => '', 'SERVER_SOFTWARE' => 'Apache/2.2.26 (Win32)', 'SERVER_NAME' => 'localhost', 'SERVER_ADDR' => '127.0.0.1', 'SERVER_PORT' => '80', 'REMOTE_ADDR' => '127.0.0.1', 'DOCUMENT_ROOT' => 'D:/OpenServer/domains/localhost', 'SERVER_ADMIN' => '[no address given]', 'SCRIPT_FILENAME' => 'D:/OpenServer/domains/localhost/baby/web/index.php', 'REMOTE_PORT' => '1340', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => '', 'REQUEST_URI' => '/baby/web/index.php/questions/icons/create', 'SCRIPT_NAME' => '/baby/web/index.php', 'PATH_INFO' => '/questions/icons/create', 'PATH_TRANSLATED' => 'redirect:\\index.php\\icons\\create', 'PHP_SELF' => '/baby/web/index.php/questions/icons/create', 'REQUEST_TIME_FLOAT' => 1398670459.6400001, 'REQUEST_TIME' => 1398670459, 'argv' => array ( ), 'argc' => 0, ); $_COOKIE = array ( '_csrf' => '06500e71bfab15d3659d43db530cef4735914a5e997123013ad68983033cdabcs:32:"5Bp5PA9OLMxfN2az535oZWmvyX3iCpPC";', 'PHPSESSID' => '2rqs27s8b3mohcn00c6tcpnha4', '_identity' => 'ae01722b097ab814feed4d6735a15a23b5e5673c22514318637190dc2d8ae9e4s:28:"["100","test100key",2592000]";', ); $_SESSION = array ( '__flash' => array ( ), '__id' => '100', ); $_ENV = array ( 'ALLUSERSPROFILE' => 'C:\\Documents and Settings\\All Users', 'APPDATA' => 'C:\\Documents and Settings\\Martemyanov\\Application Data', 'CommonProgramFiles' => 'C:\\Program Files\\Common Files', 'COMPUTERNAME' => 'MARTEMYANOV', 'ComSpec' => 'C:\\WINDOWS\\system32\\cmd.exe', 'FP_NO_HOST_CHECK' => 'NO', 'HOMEDRIVE' => 'C:', 'HOMEPATH' => '\\Documents and Settings\\Martemyanov', 'LOGONSERVER' => '\\\\DC1', 'NUMBER_OF_PROCESSORS' => '2', 'OS' => 'Windows_NT', 'Path' => 'D:\\OpenServer\\modules\\php\\PHP-5.4.22\\ext;D:\\OpenServer\\modules\\php\\PHP-5.4.22\\pear;D:\\OpenServer\\modules\\imagemagick;D:\\OpenServer\\modules\\php\\PHP-5.4.22;D:\\OpenServer\\modules\\database\\MySQL-5.5.35\\bin;D:\\OpenServer\\modules\\http\\Apache-2.2.26\\bin;D:\\OpenServer\\modules\\http\\Apache-2.2.26;D:\\OpenServer\\modules\\wget\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\system32\\Wbem', 'PATHEXT' => '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH', 'PHPBIN' => 'D:\\OpenServer\\modules\\php\\PHP-5.4.22\\php.exe', 'PHPDIR' => 'D:\\OpenServer\\modules\\php\\PHP-5.4.22\\', 'PHPRC' => 'D:\\OpenServer\\userdata\\temp\\config', 'PHP_BIN' => 'D:\\OpenServer\\modules\\php\\PHP-5.4.22\\php.exe', 'PHP_DIR' => 'D:\\OpenServer\\modules\\php\\PHP-5.4.22\\', 'PHP_INI' => 'D:\\OpenServer\\userdata\\temp\\config\\php.ini', 'PROCESSOR_ARCHITECTURE' => 'x86', 'PROCESSOR_IDENTIFIER' => 'x86 Family 6 Model 23 Stepping 10, GenuineIntel', 'PROCESSOR_LEVEL' => '6', 'PROCESSOR_REVISION' => '170a', 'ProgramFiles' => 'C:\\Program Files', 'SESSIONNAME' => 'Console', 'SystemDrive' => 'C:', 'SystemRoot' => 'C:\\WINDOWS', 'TEMP' => 'D:\\OpenServer\\userdata\\temp', 'TMP' => 'D:\\OpenServer\\userdata\\temp', 'USERDNSDOMAIN' => 'SCOURT.LOCAL', 'USERDOMAIN' => 'SCOURT', 'USERNAME' => 'Martemyanov', 'USERPROFILE' => 'C:\\Documents and Settings\\Martemyanov', 'windir' => 'C:\\WINDOWS', 'AP_PARENT_PID' => '3772', ); 2014-04-28, 11:34:20 Apache/2.2.26 (Win32) Yii Framework/2.0.0-dev
brogine commented 10 years ago

Hi, this error happens when Yii can't find the specified translation file. The solution i've found for this is telling where to look for those files.

'components' => [
/* Other components configurations */
 'i18n'=>array(
  'translations' => array(
    'sweelix'=>array(
      'class' => 'yii\i18n\PhpMessageSource',
      'basePath' => "@app/messages",
      'sourceLanguage' => 'YOUR_LANGUAGE',
      'fileMap' => array(
        'sweelix'=>'sweelix.php'    
      )
    )
  )
), 
],

Then, you go to your's web dir and create a file under the following folder structure: Create messages folder and it's subfolder based on your current language settings if they don't exist.

@webroot/messages/YOUR_LANGUAGE/sweelix.php

omer-sds commented 7 years ago

where would i get the sweelix.php from that i would place it inside the @webroot/messages/YOUR_LANGUAGE/ folder structure, i am using yii2-advanced-app .