diff options
author | Chris Case <kahotep@bunda.dreamhost.com> | 2011-05-21 21:40:16 -0700 |
---|---|---|
committer | Chris Case <kahotep@bunda.dreamhost.com> | 2011-05-21 21:40:16 -0700 |
commit | 4cff911939b263993eb41682ca558c975e2db01f (patch) | |
tree | 78f58e08d04413827744689d0f5df7660bee6caa /util/php2po.php | |
parent | 2cf696d0b5d647e1741d2f94ee379aa19b25ae1b (diff) | |
parent | f3f063c0dd7fd8b706987b856d79c7b58924acbb (diff) | |
download | volse-hubzilla-4cff911939b263993eb41682ca558c975e2db01f.tar.gz volse-hubzilla-4cff911939b263993eb41682ca558c975e2db01f.tar.bz2 volse-hubzilla-4cff911939b263993eb41682ca558c975e2db01f.zip |
merged multipart email changes
Diffstat (limited to 'util/php2po.php')
-rw-r--r-- | util/php2po.php | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/util/php2po.php b/util/php2po.php new file mode 100644 index 000000000..d3ce0a5af --- /dev/null +++ b/util/php2po.php @@ -0,0 +1,71 @@ +<?php + + if(! class_exists('App')) { + class TmpA { + public $strings = Array(); + } + $a = new TmpA(); + } + + if ($argc!=2) { + print "Usage: ".$argv[0]." <strings.php>\n\n"; + return; + } + + $phpfile = $argv[1]; + $pofile = dirname($phpfile)."/messages.po"; + + if (!file_exists($phpfile)){ + print "Unable to find '$phpfile'\n"; + return; + } + + include_once($phpfile); + + print "Out to '$pofile'\n"; + + $out = ""; + $infile = file($pofile); + $k=""; + $ink = False; + foreach ($infile as $l) { + + if ($k!="" && substr($l,0,7)=="msgstr "){ + $ink = False; + $v = '""'; + //echo "DBG: k:'$k'\n"; + if (isset($a->strings[$k])) { + $v= '"'.$a->strings[$k].'"'; + //echo "DBG\n"; + //var_dump($k, $v, $a->strings[$k], $v); + //echo "/DBG\n"; + + } + //echo "DBG: v:'$v'\n"; + $l = "msgstr ".$v."\n"; + } + + if (substr($l,0,6)=="msgid_" || substr($l,0,7)=="msgstr[" )$ink = False;; + + if ($ink) { + $k .= trim($l,"\"\r\n"); + $k = str_replace('\"','"',$k); + } + + if (substr($l,0,6)=="msgid "){ + $arr=False; + $k = str_replace("msgid ","",$l); + if ($k != '""' ) { + $k = trim($k,"\"\r\n"); + $k = str_replace('\"','"',$k); + } else { + $k = ""; + } + $ink = True; + } + + $out .= $l; + } + //echo $out; + file_put_contents($pofile, $out); +?>
\ No newline at end of file |