aboutsummaryrefslogtreecommitdiffstats
path: root/util/extract.php
diff options
context:
space:
mode:
authorChris Case <kahotep@bunda.dreamhost.com>2011-05-21 21:40:16 -0700
committerChris Case <kahotep@bunda.dreamhost.com>2011-05-21 21:40:16 -0700
commit4cff911939b263993eb41682ca558c975e2db01f (patch)
tree78f58e08d04413827744689d0f5df7660bee6caa /util/extract.php
parent2cf696d0b5d647e1741d2f94ee379aa19b25ae1b (diff)
parentf3f063c0dd7fd8b706987b856d79c7b58924acbb (diff)
downloadvolse-hubzilla-4cff911939b263993eb41682ca558c975e2db01f.tar.gz
volse-hubzilla-4cff911939b263993eb41682ca558c975e2db01f.tar.bz2
volse-hubzilla-4cff911939b263993eb41682ca558c975e2db01f.zip
merged multipart email changes
Diffstat (limited to 'util/extract.php')
-rw-r--r--util/extract.php47
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();