i18n CLI improve parsing (#4197)

https://github.com/FreshRSS/FreshRSS/pull/3932#discussion_r800043744
This commit is contained in:
Alexandre Alapetite authored and GitHub committed 2022-02-05 13:23:44 +01:00
1 parent 9224668285
commit e28a2e320e
1 file changed
+12 -4
+12 -4
View File
@@ -54,16 +54,24 @@ class I18nFile {
$content = str_replace('<?php', '', $content);
$content = preg_replace([
"#',\s*//\s*TODO#i",
"#',\s*//\s*DIRTY#i",
"#',\s*//\s*IGNORE#i",
"#',\s*//\s*TODO.*#i",
"#',\s*//\s*DIRTY.*#i",
"#',\s*//\s*IGNORE.*#i",
], [
' -> todo\',',
' -> dirty\',',
' -> ignore\',',
], $content);
$content = eval($content);
try {
$content = eval($content);
} catch (ParseError $ex) {
if (defined('STDERR')) {
fwrite(STDERR, "Error while processing: $filename\n");
fwrite(STDERR, $ex);
}
die(1);
}
if (is_array($content)) {
return $content;