diff options
author | Friendika <info@friendika.com> | 2011-03-18 05:07:42 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-03-18 05:07:42 -0700 |
commit | 9838245c6c9b2e311650b53a1c3aa1ef778ef935 (patch) | |
tree | ceb9f5edd50cd039e28362a59c4c2d354bb88e67 /util/extract.php | |
parent | 43234a667878327a825914070884161c6d57271e (diff) | |
parent | e307846c2d89cf450ed2e7ddf8f325f5f4581f8f (diff) | |
download | volse-hubzilla-9838245c6c9b2e311650b53a1c3aa1ef778ef935.tar.gz volse-hubzilla-9838245c6c9b2e311650b53a1c3aa1ef778ef935.tar.bz2 volse-hubzilla-9838245c6c9b2e311650b53a1c3aa1ef778ef935.zip |
Merge branch 'gettext' of https://github.com/fabrixxm/friendika into fabrixxm-gettext
Diffstat (limited to 'util/extract.php')
-rw-r--r-- | util/extract.php | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/util/extract.php b/util/extract.php index 92ec8501c..90127f3c1 100644 --- a/util/extract.php +++ b/util/extract.php @@ -10,25 +10,50 @@ $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 = '<?php' . "\n"; - foreach($arr as $a) { - if(substr($a,0,1) == '$') - continue; + $s .= ' +function string_plural_select($n){ + return ($n != 1); +} - $s .= '$a->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(); |