Fix util/php2po

- Remove use
- Simplify object handling
- Fix wrong `|| die()` structure
This commit is contained in:
Hypolite Petovan 2018-01-24 16:54:52 -05:00
parent 3e7f683533
commit e51c4a38ad

20
util/php2po.php Normal file → Executable file
View file

@ -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 = [];
}
$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";
@ -93,8 +87,14 @@ print "\nLoading base message.po...";
// load base messages.po and extract msgids
$base_msgids = [];
$norm_base_msgids = [];
$base_f = file("util/messages.po") || die("No base messages.po\n");
$_f = 0; $_mid = ""; $_mids = [];
$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";