Hello… I installed jformvalidate extension whose messages I need to translate into Spanish.
I am trying to use yiic tool to generate the files but I cannot do it because I don’t know which configuration file I have to provide. I have only one configuration file that is called “main.php”, so that, I tried “yiic message config/main.php” but it didn’t work.
Hi Jaime, this maybe the blind leading the blind but I created another file in the config directory called messages, and I set up name value pairs according to the usage info it gives when it fails. Then I pointed my yiic at that.
Here is the file I made
<?php
// This is hopefully a config array for the messages
return array(
'sourcePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..', //root dir of all source
'messagePath' => '/path/to/protected/messages', //root dir of message translations
'languages' => array('es_mx',), //array of lang codes to translate to, e.g. es_mx
'fileTypes' => array('php','js',), //array of extensions no dot all others excluded
'exclude' => array('.svn',), //list of paths or files to exclude
'translator' => 'Yii:t', //this is the default but lets be complete
);
This file is in protected/config/messages.php
So I ran cat /full/path/to/messages.php and it certainly exist. Then I copy this same file path to yiic
./yiic message /full/path/to/messages.php and it gives same error emssage as before says like it can’t find the config file. I know the file exists.
Is this what you are suppose to do? OBVIOUSLY NOT! So given this doesn’t work, WHAT DOES? Remember we’re NOOBS. Don’t assume anything. Please help! A fully worked example will be tremendously helpful!
Finally it gets one more step. It recognize the config file. Then it gives lots of
Extracting messages from /path/to/protected/controllers/SiteController.php… messages etc.
but Does not put any data anywhere so Im not sure what reallyy hpapened. Is there suppose to be translations already done, don’t you have to wrap all strings with Yii::t() so that poedit can pull out to begin with? I did a few but not all. EXACTLY what code do I change and EXACTLY WHERE is it to do GetText instead of PHP arrays.
that script runs as me ad I own the messages directory.
Also don’t we take out big text chunks and token ize them.
<?php
// This is hopefully a config array for the messages
return array(
'sourcePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..', //root dir of all source
'messagePath' => '/path/to/protected/messages', //root dir of message translations
'languages' => array('es_mx',), //array of lang codes to translate to, e.g. es_mx
'fileTypes' => array('php','js',), //array of extensions no dot all others excluded
'exclude' => array('.svn',), //list of paths or files to exclude
'translator' => 'Yii:t', //this is the default but lets be complete
);
Here is your error : ‘translator’ => ‘Yii:t’ the default translator is ‘Yii::t’
If you want to translate your app point sourcePath to your "protected" dir.
if you want to translate the core messages point sourcePath to your yii framework path.