mirror of
https://github.com/friendica/friendica
synced 2025-04-27 15:50:12 +00:00
extract.php extract tt(). Updated strings.php
This commit is contained in:
parent
a7af6df962
commit
d6b4940ddd
2 changed files with 98 additions and 86 deletions
|
@ -10,25 +10,50 @@
|
|||
$str = file_get_contents($file);
|
||||
|
||||
$pat = '| t\(([^\)]*)\)|';
|
||||
$patt = '| tt\(([^\)]*)\)|';
|
||||
|
||||
preg_match_all($pat,$str,$matches);
|
||||
preg_match_all($patt, $str, $matchestt);
|
||||
|
||||
|
||||
if(! count($matches))
|
||||
continue;
|
||||
|
||||
foreach($matches[1] as $match) {
|
||||
if(! in_array($match,$arr))
|
||||
$arr[] = $match;
|
||||
if(count($matches)){
|
||||
foreach($matches[1] as $match) {
|
||||
if(! in_array($match,$arr))
|
||||
$arr[] = $match;
|
||||
}
|
||||
}
|
||||
if(count($matchestt)){
|
||||
foreach($matchestt[1] as $match) {
|
||||
$matchtkns = preg_split("|[ \t\r\n]*,[ \t\r\n]*|",$match);
|
||||
if (count($matchtkns)==3 && !in_array($matchtkns,$arr)){
|
||||
$arr[] = $matchtkns;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$s = '<?php' . "\n";
|
||||
foreach($arr as $a) {
|
||||
if(substr($a,0,1) == '$')
|
||||
continue;
|
||||
$s .= '
|
||||
function string_plural_select($n){
|
||||
return ($n != 1);
|
||||
}
|
||||
|
||||
$s .= '$a->strings[' . $a . '] = ' . $a . ';' . "\n";
|
||||
';
|
||||
|
||||
foreach($arr as $a) {
|
||||
if (is_array($a)){
|
||||
if(substr($a[1],0,1) == '$')
|
||||
continue;
|
||||
$s .= '$a->strings[' . $a[0] . "] = array(\n";
|
||||
$s .= "\t0 => ". $a[0]. ",\n";
|
||||
$s .= "\t1 => ". $a[1]. ",\n";
|
||||
$s .= ");\n";
|
||||
} else {
|
||||
if(substr($a,0,1) == '$')
|
||||
continue;
|
||||
$s .= '$a->strings[' . $a . '] = '. $a . ';' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$zones = timezone_identifiers_list();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue