mirror of
https://github.com/friendica/friendica
synced 2025-04-25 07:10:11 +00:00
Revert "Coding convention applied - part 1"
This commit is contained in:
parent
9c2c483996
commit
7b352f3f74
181 changed files with 3507 additions and 4338 deletions
|
@ -12,11 +12,10 @@ function po2php_run(&$argv, &$argc) {
|
|||
$pofile = $argv[1];
|
||||
$outfile = dirname($pofile)."/strings.php";
|
||||
|
||||
if (strstr($outfile,'util')) {
|
||||
if(strstr($outfile,'util'))
|
||||
$lang = 'en';
|
||||
} else {
|
||||
else
|
||||
$lang = str_replace('-','_',basename(dirname($pofile)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -42,45 +41,34 @@ function po2php_run(&$argv, &$argc) {
|
|||
foreach ($infile as $l) {
|
||||
$l = str_replace('\"', DQ_ESCAPE, $l);
|
||||
$len = strlen($l);
|
||||
if ($l[0]=="#") {
|
||||
$l="";
|
||||
}
|
||||
if (substr($l,0,15) == '"Plural-Forms: '){
|
||||
if ($l[0]=="#") $l="";
|
||||
if (substr($l,0,15)=='"Plural-Forms: '){
|
||||
$match=Array();
|
||||
preg_match("|nplurals=([0-9]*); *plural=(.*)[;\\\\]|", $l, $match);
|
||||
$cond = str_replace('n','$n',$match[2]);
|
||||
// define plural select function if not already defined
|
||||
$fnname = 'string_plural_select_' . $lang;
|
||||
$out .= 'if (! function_exists("'.$fnname.'")) {'."\n";
|
||||
$out .= 'if(! function_exists("'.$fnname.'")) {'."\n";
|
||||
$out .= 'function '. $fnname . '($n){'."\n";
|
||||
$out .= ' return '.$cond.';'."\n";
|
||||
$out .= '}}'."\n";
|
||||
}
|
||||
|
||||
if ($k!="" && substr($l,0,7) == "msgstr "){
|
||||
if ($ink) {
|
||||
$ink = False;
|
||||
$out .= '$a->strings["'.$k.'"] = ';
|
||||
}
|
||||
if ($inv) {
|
||||
$inv = False;
|
||||
$out .= '"'.$v.'"';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($k!="" && substr($l,0,7)=="msgstr "){
|
||||
if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; }
|
||||
if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
|
||||
|
||||
$v = substr($l,8,$len-10);
|
||||
$v = preg_replace_callback($escape_s_exp,'escape_s',$v);
|
||||
$inv = True;
|
||||
//$out .= $v;
|
||||
}
|
||||
if ($k!="" && substr($l,0,7) == "msgstr["){
|
||||
if ($ink) {
|
||||
$ink = False;
|
||||
$out .= '$a->strings["'.$k.'"] = ';
|
||||
}
|
||||
if ($inv) {
|
||||
$inv = False;
|
||||
$out .= '"'.$v.'"';
|
||||
}
|
||||
if ($k!="" && substr($l,0,7)=="msgstr["){
|
||||
if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; }
|
||||
if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
|
||||
|
||||
if (!$arr) {
|
||||
$arr=True;
|
||||
|
@ -96,6 +84,7 @@ function po2php_run(&$argv, &$argc) {
|
|||
|
||||
if (substr($l,0,6)=="msgid_") { $ink = False; $out .= '$a->strings["'.$k.'"] = '; };
|
||||
|
||||
|
||||
if ($ink) {
|
||||
$k .= trim($l,"\"\r\n");
|
||||
$k = preg_replace_callback($escape_s_exp,'escape_s',$k);
|
||||
|
@ -103,14 +92,9 @@ function po2php_run(&$argv, &$argc) {
|
|||
}
|
||||
|
||||
if (substr($l,0,6)=="msgid "){
|
||||
if ($inv) {
|
||||
$inv = False;
|
||||
$out .= '"'.$v.'"';
|
||||
}
|
||||
if ($k != "") {
|
||||
$out .= $arr?");\n":";\n";
|
||||
}
|
||||
$arr = False;
|
||||
if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
|
||||
if ($k!="") $out .= $arr?");\n":";\n";
|
||||
$arr=False;
|
||||
$k = str_replace("msgid ","",$l);
|
||||
if ($k != '""' ) {
|
||||
$k = trim($k,"\"\r\n");
|
||||
|
@ -131,13 +115,8 @@ function po2php_run(&$argv, &$argc) {
|
|||
|
||||
}
|
||||
|
||||
if ($inv) {
|
||||
$inv = False;
|
||||
$out .= '"'.$v.'"';
|
||||
}
|
||||
if ($k!="") {
|
||||
$out .= $arr?");\n":";\n";
|
||||
}
|
||||
if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
|
||||
if ($k!="") $out .= $arr?");\n":";\n";
|
||||
|
||||
$out = str_replace(DQ_ESCAPE, '\"', $out);
|
||||
file_put_contents($outfile, $out);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue