]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Console/PoToPhp.php
Merge pull request #6746 from nupplaphil/issue/6338-notices
[friendica.git] / src / Core / Console / PoToPhp.php
index 1cfc1ec7fd93e70b4019c17355a47a05977dae9d..d539eae5b6a3f221317fbe5cb58ccff1f5664889 100644 (file)
@@ -5,7 +5,7 @@ namespace Friendica\Core\Console;
 /**
  * Read a messages.po file and create strings.php in the same directory
  *
- * @author Hypolite Petovan <mrpetovan@gmail.com>
+ * @author Hypolite Petovan <hypolite@mrpetovan.com>
  */
 class PoToPhp extends \Asika\SimpleConsole\Console
 {
@@ -47,8 +47,6 @@ HELP;
                        throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
                }
 
-               $a = get_app();
-
                $pofile = realpath($this->getArgument(0));
 
                if (!file_exists($pofile)) {
@@ -61,7 +59,7 @@ HELP;
 
                $outfile = dirname($pofile) . DIRECTORY_SEPARATOR . 'strings.php';
 
-               if (strstr($outfile, 'util')) {
+               if (basename(dirname($pofile)) == 'C') {
                        $lang = 'en';
                } else {
                        $lang = str_replace('-', '_', basename(dirname($pofile)));
@@ -94,6 +92,7 @@ HELP;
                                $fnname = 'string_plural_select_' . $lang;
                                $out .= 'if(! function_exists("' . $fnname . '")) {' . "\n";
                                $out .= 'function ' . $fnname . '($n){' . "\n";
+                               $out .= '       $n = intval($n);' . "\n";
                                $out .= '       return ' . $cond . ';' . "\n";
                                $out .= '}}' . "\n";
                        }
@@ -105,11 +104,10 @@ HELP;
                                }
 
                                if ($inv) {
-                                       $inv = false;
                                        $out .= '"' . $v . '"';
                                }
 
-                               $v = substr($l, 8, $len - 11);
+                               $v = substr($l, 8, $len - 10);
                                $v = preg_replace_callback($escape_s_exp, [$this, 'escapeDollar'], $v);
 
                                $inv = true;
@@ -178,7 +176,6 @@ HELP;
                }
 
                if ($inv) {
-                       $inv = false;
                        $out .= '"' . $v . '"';
                }