| 152 |
function updateFiles() { |
function updateFiles() { |
| 153 |
$dir = $this->path . $this->name . '/'; |
$dir = $this->path . $this->name . '/'; |
| 154 |
$langfiles = mosReadDirectory($dir, '.po$'); |
$langfiles = mosReadDirectory($dir, '.po$'); |
| 155 |
|
/*set_time_limit(360);*/ |
| 156 |
|
|
| 157 |
|
$admin = new PHPGettextAdmin(); |
| 158 |
|
$cmd = "msgcat --use-first -o $dir"."compendium.po ".$dir.implode(" $dir", $langfiles); |
| 159 |
|
$admin->execute($cmd); |
| 160 |
|
|
| 161 |
foreach ($langfiles as $lf) { |
foreach ($langfiles as $lf) { |
| 162 |
$domain = substr($lf, 0, -3); |
$domain = substr($lf, 0, -3); |
| 163 |
$catalog = new PHPGettext_Catalog($domain, $this->path); |
$catalog = new PHPGettext_Catalog($domain, $this->path); |
| 170 |
$file['percent'] = ''; |
$file['percent'] = ''; |
| 171 |
$file['translated'] = 0; |
$file['translated'] = 0; |
| 172 |
$file['fuzzy'] = 0; |
$file['fuzzy'] = 0; |
| 173 |
|
$pluralfuzz = false; |
| 174 |
foreach ($catalog->strings as $msg) { |
foreach ($catalog->strings as $msg) { |
| 175 |
if (!is_array($msg->msgstr) && !empty($msg->msgstr) && !$msg->is_fuzzy) { |
if (!is_array($msg->msgstr) && !empty($msg->msgstr) && !$msg->is_fuzzy) { |
| 176 |
$file['translated']++; |
$file['translated']++; |
| 177 |
} elseif ($msg->is_fuzzy) { |
} |
| 178 |
|
if ($msg->is_fuzzy) { |
| 179 |
$file['fuzzy']++; |
$file['fuzzy']++; |
| 180 |
} |
} |
| 181 |
} |
} |
| 182 |
|
|
| 183 |
|
|
| 184 |
$nonfuzzy = $file['strings'] - $file['fuzzy']; |
$nonfuzzy = $file['strings'] - $file['fuzzy']; |
| 185 |
if (!$nonfuzzy) $nonfuzzy = 1; |
if (!$nonfuzzy) $nonfuzzy = 1; |
| 186 |
$file['percent'] = round($file['translated'] * 100 / $nonfuzzy, 2); |
$file['percent'] = round($file['translated'] * 100 / $nonfuzzy, 2); |