aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2018-07-29 07:14:09 +0200
committerMario <mario@mariovavti.com>2018-07-29 07:14:09 +0200
commit08a8011456c61ef52acf36bcdaa759a7027599a6 (patch)
treee16b41a2bb21c0d638b589ad904ccd0d4a695582
parent643b6f0aa3a4f082fb34ade6508dd42b9c458822 (diff)
parent77dfe63d909202526fd6ffae25f4c14850c5c2a1 (diff)
downloadvolse-hubzilla-08a8011456c61ef52acf36bcdaa759a7027599a6.tar.gz
volse-hubzilla-08a8011456c61ef52acf36bcdaa759a7027599a6.tar.bz2
volse-hubzilla-08a8011456c61ef52acf36bcdaa759a7027599a6.zip
Merge branch 'patch-12' into 'dev'
Process msgctxt plurals See merge request hubzilla/core!1246
-rw-r--r--util/php2po.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/util/php2po.php b/util/php2po.php
index 459226f85..99578a12d 100644
--- a/util/php2po.php
+++ b/util/php2po.php
@@ -33,9 +33,16 @@
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);
$v = "";
if (isset(App::$strings[$k])) {
$v = App::$strings[$k];
+ } else {
+ $k = "__ctx:".$c."__ ".$k;
+ if (isset(App::$strings[$k]))
+ $v = App::$strings[$k];
+ }
+ if (!empty($v)) {
if (is_array($v)) {
$l = "";
$n = 0;
@@ -53,20 +60,19 @@
if ($ink) {
$k .= trim($l,"\"\r\n");
- $k = str_replace('\"','"',$k);
}
- if (substr($l,0,6)=="msgid "){
- $k = str_replace("msgid ","",$l);
- if ($k != '""' ) {
- $k = trim($k,"\"\r\n");
- $k = str_replace('\"','"',$k);
- } else {
- $k = "";
- }
+ if (substr($l,0,6)=="msgid ") {
+ preg_match('/^msgid "(.*)"/',$l,$m);
+ $k = $m[1];
$ink = True;
}
+ if (substr($l,0,8)=="msgctxt ") {
+ preg_match('/^msgctxt "(.*)"/',$l,$m);
+ $c = $m[1];
+ }
+
$out .= $l;
}
}