Fix util/php2po
- Remove use - Simplify object handling - Fix wrong `|| die()` structure
This commit is contained in:
parent
3e7f683533
commit
e51c4a38ad
20
util/php2po.php
Normal file → Executable file
20
util/php2po.php
Normal file → Executable file
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Read strings.php file and create messages.po
|
* Read strings.php file and create messages.po
|
||||||
|
@ -7,16 +8,9 @@
|
||||||
* Output to <path/to/messages.po>
|
* Output to <path/to/messages.po>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
|
||||||
|
|
||||||
DEFINE("NORM_REGEXP", "|[\\\]|");
|
DEFINE("NORM_REGEXP", "|[\\\]|");
|
||||||
|
|
||||||
if(! class_exists('App')) {
|
$a = new stdClass();
|
||||||
class TmpA {
|
|
||||||
public $strings = [];
|
|
||||||
}
|
|
||||||
$a = new TmpA();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($argc<2 || in_array('-h', $argv) || in_array('--h', $argv)) {
|
if ($argc<2 || in_array('-h', $argv) || in_array('--h', $argv)) {
|
||||||
print "Usage: ".$argv[0]." [-p <n>] <strings.php>\n\n";
|
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
|
// load base messages.po and extract msgids
|
||||||
$base_msgids = [];
|
$base_msgids = [];
|
||||||
$norm_base_msgids = [];
|
$norm_base_msgids = [];
|
||||||
$base_f = file("util/messages.po") || die("No base messages.po\n");
|
$base_f = file("util/messages.po");
|
||||||
$_f = 0; $_mid = ""; $_mids = [];
|
if (!$base_f) {
|
||||||
|
die("No base messages.po\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
$_f = 0;
|
||||||
|
$_mid = "";
|
||||||
|
$_mids = [];
|
||||||
foreach( $base_f as $l) {
|
foreach( $base_f as $l) {
|
||||||
$l = trim($l);
|
$l = trim($l);
|
||||||
//~ print $l."\n";
|
//~ print $l."\n";
|
||||||
|
|
Loading…
Reference in a new issue