/**
* Read a messages.po file and create strings.php in the same directory
*
- * @author Hypolite Petovan <mrpetovan@gmail.com>
+ * @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class PoToPhp extends \Asika\SimpleConsole\Console
{
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
- $a = get_app();
-
$pofile = realpath($this->getArgument(0));
if (!file_exists($pofile)) {
$outfile = dirname($pofile) . DIRECTORY_SEPARATOR . 'strings.php';
- if (strstr($outfile, 'util')) {
+ if (basename(dirname($pofile)) == 'C') {
$lang = 'en';
} else {
$lang = str_replace('-', '_', basename(dirname($pofile)));
$fnname = 'string_plural_select_' . $lang;
$out .= 'if(! function_exists("' . $fnname . '")) {' . "\n";
$out .= 'function ' . $fnname . '($n){' . "\n";
+ $out .= ' $n = intval($n);' . "\n";
$out .= ' return ' . $cond . ';' . "\n";
$out .= '}}' . "\n";
}
}
if ($inv) {
- $inv = false;
$out .= '"' . $v . '"';
}
}
if ($inv) {
- $inv = false;
$out .= '"' . $v . '"';
}