]> git.mxchange.org Git - friendica.git/blobdiff - util/php2po.php
Merge pull request #4505 from annando/update-avatar
[friendica.git] / util / php2po.php
old mode 100644 (file)
new mode 100755 (executable)
index e07f718..e28c91d
@@ -1,3 +1,4 @@
+#!/usr/bin/env php
 <?php
 /**
  * Read strings.php file and create messages.po
@@ -7,16 +8,9 @@
  * Output to <path/to/messages.po>
  */
 
-use Friendica\App;
-
 DEFINE("NORM_REGEXP", "|[\\\]|");
 
-if(! class_exists('App')) {
-       class TmpA {
-               public $strings = Array();
-       }
-       $a = new TmpA();
-}
+$a = new stdClass();
 
 if ($argc<2 || in_array('-h', $argv) || in_array('--h', $argv)) {
        print "Usage: ".$argv[0]." [-p <n>] <strings.php>\n\n";
@@ -91,10 +85,16 @@ $out .= "\n";
 print "\nLoading base message.po...";
 
 // load base messages.po and extract msgids
-$base_msgids = array();
-$norm_base_msgids = array();
-$base_f = file("util/messages.po") or die("No base messages.po\n");
-$_f = 0; $_mid = ""; $_mids = array();
+$base_msgids = [];
+$norm_base_msgids = [];
+$base_f = file("util/messages.po");
+if (!$base_f) {
+       die("No base messages.po\n");
+}
+
+$_f = 0;
+$_mid = "";
+$_mids = [];
 foreach( $base_f as $l) {
        $l = trim($l);
        //~ print $l."\n";
@@ -108,7 +108,7 @@ foreach( $base_f as $l) {
 
                $_f = 0;
                $_mid = "";
-               $_mids = array();
+               $_mids = [];
 
        }
 
@@ -130,7 +130,7 @@ foreach( $base_f as $l) {
        if (startsWith($l, 'msgid ')) {
                $_f = 1;
                $_mid = str_replace('msgid ', '' , $l);
-                       $_mids = array($_mid);
+                       $_mids = [$_mid];
                //~ print "\t mid: $_mid \n";
        }
        //~ print "\t\t\t\t$_f\n\n";