X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=util%2Fextract.php;h=90127f3c1b2e4811108ed85c62a53027eb638e8c;hb=a2d3cee0063cd2f99b6724d81e77fd31914de928;hp=bb16a47da142914f034f235b5deed7f074cf20de;hpb=e25e40f1ef4e1ad703c55b13069461ee0d712eae;p=friendica.git diff --git a/util/extract.php b/util/extract.php index bb16a47da1..90127f3c1b 100644 --- a/util/extract.php +++ b/util/extract.php @@ -3,32 +3,57 @@ $arr = array(); $files = array('index.php','boot.php'); - $files = array_merge($files,glob('mod/*'),glob('include/*')); + $files = array_merge($files,glob('mod/*'),glob('include/*'),glob('addon/*/*')); foreach($files as $file) { $str = file_get_contents($file); $pat = '| t\(([^\)]*)\)|'; + $patt = '| tt\(([^\)]*)\)|'; preg_match_all($pat,$str,$matches); - - if(! count($matches)) - continue; - - foreach($matches[1] as $match) { - if(! in_array($match,$arr)) - $arr[] = $match; + preg_match_all($patt, $str, $matchestt); + + + if(count($matches)){ + foreach($matches[1] as $match) { + if(! in_array($match,$arr)) + $arr[] = $match; + } + } + if(count($matchestt)){ + foreach($matchestt[1] as $match) { + $matchtkns = preg_split("|[ \t\r\n]*,[ \t\r\n]*|",$match); + if (count($matchtkns)==3 && !in_array($matchtkns,$arr)){ + $arr[] = $matchtkns; + } + } } } $s = 'strings[' . $a . '] = ' . $a . ';' . "\n"; +'; + + foreach($arr as $a) { + if (is_array($a)){ + if(substr($a[1],0,1) == '$') + continue; + $s .= '$a->strings[' . $a[0] . "] = array(\n"; + $s .= "\t0 => ". $a[0]. ",\n"; + $s .= "\t1 => ". $a[1]. ",\n"; + $s .= ");\n"; + } else { + if(substr($a,0,1) == '$') + continue; + $s .= '$a->strings[' . $a . '] = '. $a . ';' . "\n"; + } } $zones = timezone_identifiers_list();