diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-05-18 17:00:04 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-05-18 17:00:04 -0700 |
commit | 71a2f2d773526b7158e739e20fcfe3598d822ad4 (patch) | |
tree | e9ca52521f0aa99b1b2cbcd0950e21f789af6d9f /util/po2php.php | |
parent | 2dd0e7f6bd02748567d8b21f793bd8c6f15f55ce (diff) | |
parent | ad07d48d3cca06ccc0cc8532d5476fc20b878f3f (diff) | |
download | volse-hubzilla-71a2f2d773526b7158e739e20fcfe3598d822ad4.tar.gz volse-hubzilla-71a2f2d773526b7158e739e20fcfe3598d822ad4.tar.bz2 volse-hubzilla-71a2f2d773526b7158e739e20fcfe3598d822ad4.zip |
Merge branch 'master' of https://github.com/redmatrix/redmatrix
Diffstat (limited to 'util/po2php.php')
-rw-r--r-- | util/po2php.php | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/util/po2php.php b/util/po2php.php index cf295d8cb..34aedf030 100644 --- a/util/po2php.php +++ b/util/po2php.php @@ -35,10 +35,13 @@ function po2php_run($argv, $argc) { $ink = False; $inv = False; $escape_s_exp = '|[^\\\\]\$[a-z]|'; + function escape_s($match){ return str_replace('$','\$',$match[0]); } + foreach ($infile as $l) { + $l = str_replace(array('$projectname','$Projectname'),array('\$projectname','\$Projectname'),$l); $len = strlen($l); if ($l[0]=="#") $l=""; if (substr($l,0,15)=='"Plural-Forms: '){ @@ -51,9 +54,6 @@ function po2php_run($argv, $argc) { $out .= '}}'."\n"; } - - - if ($k!="" && substr($l,0,7)=="msgstr "){ if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; } if ($inv) { $inv = False; $out .= '"'.$v.'"'; } @@ -64,9 +64,14 @@ function po2php_run($argv, $argc) { //$out .= $v; } if ($k!="" && substr($l,0,7)=="msgstr["){ - if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; } - if ($inv) { $inv = False; $out .= '"'.$v.'"'; } - + if ($ink) { + $ink = False; + $out .= '$a->strings["'.$k.'"] = '; + } + if ($inv) { + $inv = False; + $out .= '"'.$v.'"'; + } if (!$arr) { $arr=True; $out .= "array(\n"; @@ -79,7 +84,10 @@ function po2php_run($argv, $argc) { .preg_replace_callback($escape_s_exp,'escape_s',$match[2]) .",\n"; } - if (substr($l,0,6)=="msgid_") { $ink = False; $out .= '$a->strings["'.$k.'"] = '; }; + if (substr($l,0,6)=="msgid_") { + $ink = False; + $out .= '$a->strings["'.$k.'"] = '; + } if ($ink) { |