7 require_once
"xgettextCommon.php";
14 $phpFile = $potFile .
"_.php";
15 file_put_contents($phpFile,
'<?php' .
"\n");
16 foreach ($this->inputFiles as $layoutFile) {
17 $layoutFile = trim($layoutFile);
22 if (strrpos($layoutFile,
'.') > 0) {
23 $ext = substr($layoutFile, strrpos($layoutFile,
'.') + 1);
26 $tmpDir = $temp_file = sprintf(
"%s/%s", sys_get_temp_dir() , uniqid(
'po'));
27 $cmd = sprintf(
'mkdir %s && unzip -d %s %s content.xml meta.xml && cat %s/meta.xml >> %s/content.xml', escapeshellarg($tmpDir) , escapeshellarg($tmpDir) , escapeshellarg($layoutFile) , escapeshellarg($tmpDir) , escapeshellarg($tmpDir));
29 $layoutFile = sprintf(
"%s/content.xml", $tmpDir);
34 $cmd = sprintf(
'perl -ne \'print "\$a=gettext(\\"$1\\");\n" while(m/\[TEXT:([^]]+)]/g)\' %s >> %s', escapeshellarg($layoutFile) , escapeshellarg($phpFile));
36 $cmd = sprintf(
'perl -ne \'print "\$a=pgettext(\\"$2\\", \\"$1\\");\n" while(m/\[TEXT\(([^\)]+)\):([^]]+)]/g)\' %s >> %s', escapeshellarg($layoutFile) , escapeshellarg($phpFile));
40 $cmd = sprintf(
'\rm -r %s', escapeshellarg($tmpDir));
45 $cmd = sprintf(
'xgettext \
51 --keyword=pgettext:1,2c \
52 %s -o %s %s && rm %s', $this->getXoptions() , escapeshellarg($potFile) , escapeshellarg($phpFile) , escapeshellarg($phpFile));
foreach($argv as $arg) $cmd