diff options
author | Max Kostikov <max@kostikov.co> | 2018-07-29 16:26:33 +0200 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2018-07-29 16:26:33 +0200 |
commit | cb4afd39bd372597c66f6e14c276861f2d2b1781 (patch) | |
tree | a8040ade98fadc4352e178804491e081669fe778 | |
parent | e078caffd86feca160633778f884007acae6a9fa (diff) | |
download | volse-hubzilla-cb4afd39bd372597c66f6e14c276861f2d2b1781.tar.gz volse-hubzilla-cb4afd39bd372597c66f6e14c276861f2d2b1781.tar.bz2 volse-hubzilla-cb4afd39bd372597c66f6e14c276861f2d2b1781.zip |
Workaround on possible error
-rw-r--r-- | util/php2po.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/util/php2po.php b/util/php2po.php index a29ba7459..c710b86fe 100644 --- a/util/php2po.php +++ b/util/php2po.php @@ -35,7 +35,7 @@ if (!preg_match("/^msgstr\[[1-9]/",$l)) { if ($k!="" && (substr($l,0,7)=="msgstr " || substr($l,0,8)=="msgstr[0")){ $ink = False; - $k = str_replace('\"','"',$k); + $k = stripslashes($k); $v = ""; if (isset(App::$strings[$k])) { $v = App::$strings[$k]; @@ -44,18 +44,18 @@ if (isset(App::$strings[$k])) { $v = App::$strings[$k]; $c = ""; - } + }; } if (!empty($v)) { if (is_array($v)) { $l = ""; $n = 0; foreach ($v as &$value) { - $l .= "msgstr[".$n."] \"".str_replace('"','\"',$value)."\"\n"; + $l .= "msgstr[".$n."] \"".addcslashes($value,"\"\n")."\"\n"; $n++; } } else { - $l = "msgstr \"".str_replace('"','\"',$v)."\"\n"; + $l = "msgstr \"".addcslashes($v,"\"\n")."\"\n"; } } } @@ -63,7 +63,8 @@ if (substr($l,0,6)=="msgid_" || substr($l,0,7)=="msgstr[") $ink = False; if ($ink) { - $k .= trim($l,"\"\r\n"); + preg_match('/^"(.*)"$/',$l,$m); + $k .= $m[1]; } if (substr($l,0,6)=="msgid ") { |