diff options
-rw-r--r-- | tools/extract2gettext.php | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/extract2gettext.php b/tools/extract2gettext.php index 73e873333..1fef6732a 100644 --- a/tools/extract2gettext.php +++ b/tools/extract2gettext.php @@ -45,7 +45,7 @@ date_default_timezone_set(@date_default_timezone_get()); if(!$quiet) { echo "ohay!\n";} -$cmd = sprintf('grep -HrnEi "_(g|r|t)\([^$](.*)" %s', $php_source); +$cmd = sprintf('grep -HrnE "_(g|r|t)\([^$](.*)" %s', $php_source); if(!$quiet) { echo $cmd, "\n"; } exec($cmd, $out); @@ -67,10 +67,13 @@ foreach ($out as $str) { $arr = implode(':', $arr); $arr = str_replace('\\\'', '_apostrophe_', $arr); - if (preg_match_all('/\_(g|r|t)\(\'(.+)\'/imU', $arr, $reg)) { // i=PCRE_CASELESS, m=PCRE_MULTILINE, U=PCRE_UNGREEDY - foreach ($reg[2] as $found) { - $found = str_replace('_apostrophe_', '\'', $found); - $strings[$domain][$found][] = '/web/' . $file . ' +' . $line; + if (preg_match_all('/\_(g|r|t)\(((\'(.+)\')|("(.+)"))/mU', $arr, $reg)) { // m=PCRE_MULTILINE, U=PCRE_UNGREEDY + $results = array_merge($reg[4], $reg[6]); + foreach ($results as $found) { + if(!empty($found)) { + $found = str_replace('_apostrophe_', '\'', $found); + $strings[$domain][$found][] = '/web/' . $file . ' +' . $line; + } } } else { $parse_error = "\n\n!!!! Could not find string in $file, line $line: $str\n"; |