2 // vim: foldmethod=marker
6 * @author Yoshinari Takaoka <takaoka@beatcraft.com>
7 * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
12 // {{{ Ethna_Plugin_Handle_I18n
16 * @author Yoshinari Takaoka <takaoka@beatcraft.com>
20 class Ethna_Plugin_Handle_I18n extends Ethna_Plugin_Handle
23 * generate message catalog.
35 if (Ethna::isError($r)) {
38 list($opt_list, $arg_list) = $r;
41 if (isset($opt_list['basedir'])) {
42 $basedir = realpath(end($opt_list['basedir']));
48 if (isset($opt_list['locale'])) {
49 $locale = end($opt_list['locale']);
50 if (!preg_match('/^[A-Za-z_]+$/', $locale)) {
51 return Ethna::raiseError("You specified locale, but invalid : $locale", 'usage');
54 $locale = 'ja_JP'; // default locale.
58 $use_gettext = (isset($opt_list['gettext'])) ? true : false;
60 // generate message catalog.
61 $ret =& Ethna_Generator::generate('I18n', $basedir, $locale, $use_gettext, $arg_list);
62 if (Ethna::isError($ret)) {
63 printf("error occurred while generating skelton. please see also following error message(s)\n\n");
71 * get handler's description
75 function getDescription()
78 generate message catalog of project:
79 {$this->id} [-b|--basedir=dir] [-l|--locale=locale] [-g|--gettext] [extdir1] [extdir2] ...
90 ethna {$this->id} [-b|--basedir=dir] [-l|--locale=locale] [-g|--gettext] [extdir1] [extdir2] ...