aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorfilip <filip.komar@gmail.com>2015-02-21 22:09:58 +0100
committerfilip <filip.komar@gmail.com>2015-02-21 22:09:58 +0100
commit35fb04b2f7b6c96abf25ddc8a5ee1851c185b8c5 (patch)
tree7c1e5551f62a4df8e32632d72cabb443df2a1c9d /tools
parent481d84ac80782237da88c9d283f62c0c007b57af (diff)
downloadwww-35fb04b2f7b6c96abf25ddc8a5ee1851c185b8c5.tar
www-35fb04b2f7b6c96abf25ddc8a5ee1851c185b8c5.tar.gz
www-35fb04b2f7b6c96abf25ddc8a5ee1851c185b8c5.tar.bz2
www-35fb04b2f7b6c96abf25ddc8a5ee1851c185b8c5.tar.xz
www-35fb04b2f7b6c96abf25ddc8a5ee1851c185b8c5.zip
fix for a bug where the script couldn't handle double quotes for i18n strings
Diffstat (limited to 'tools')
-rw-r--r--tools/extract2gettext.php13
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";