2010-09-29 21:11:23 -04:00
|
|
|
<?php
|
|
|
|
|
2018-01-15 08:05:12 -05:00
|
|
|
$arr = [];
|
2010-09-29 21:11:23 -04:00
|
|
|
|
2018-01-15 08:05:12 -05:00
|
|
|
$files = ['index.php','boot.php'];
|
2011-01-27 21:45:19 -05:00
|
|
|
$files = array_merge($files,glob('mod/*'),glob('include/*'),glob('addon/*/*'));
|
2010-09-29 21:11:23 -04:00
|
|
|
|
|
|
|
|
2017-03-21 12:02:59 -04:00
|
|
|
foreach($files as $file) {
|
2010-09-29 21:11:23 -04:00
|
|
|
$str = file_get_contents($file);
|
|
|
|
|
2018-01-24 10:19:58 -05:00
|
|
|
$pat = '| L10n::t\(([^\)]*)\)|';
|
|
|
|
$patt = '| L10n::tt\(([^\)]*)\)|';
|
2010-09-29 21:11:23 -04:00
|
|
|
|
|
|
|
preg_match_all($pat,$str,$matches);
|
2011-03-13 08:51:59 -04:00
|
|
|
preg_match_all($patt, $str, $matchestt);
|
2018-01-15 08:05:12 -05:00
|
|
|
|
2011-03-13 08:51:59 -04:00
|
|
|
|
2017-03-21 12:02:59 -04:00
|
|
|
if(count($matches)){
|
|
|
|
foreach($matches[1] as $match) {
|
|
|
|
if(! in_array($match,$arr))
|
2011-03-13 08:51:59 -04:00
|
|
|
$arr[] = $match;
|
|
|
|
}
|
|
|
|
}
|
2017-03-21 12:02:59 -04:00
|
|
|
if(count($matchestt)){
|
|
|
|
foreach($matchestt[1] as $match) {
|
2011-03-13 08:51:59 -04:00
|
|
|
$matchtkns = preg_split("|[ \t\r\n]*,[ \t\r\n]*|",$match);
|
|
|
|
if (count($matchtkns)==3 && !in_array($matchtkns,$arr)){
|
|
|
|
$arr[] = $matchtkns;
|
|
|
|
}
|
|
|
|
}
|
2010-09-29 21:11:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$s = '<?php' . "\n";
|
2011-03-13 08:51:59 -04:00
|
|
|
$s .= '
|
|
|
|
function string_plural_select($n){
|
|
|
|
return ($n != 1);
|
|
|
|
}
|
2010-09-29 21:11:23 -04:00
|
|
|
|
2011-03-13 08:51:59 -04:00
|
|
|
';
|
|
|
|
|
2017-03-21 12:02:59 -04:00
|
|
|
foreach($arr as $a) {
|
2011-03-13 08:51:59 -04:00
|
|
|
if (is_array($a)){
|
2017-03-21 12:02:59 -04:00
|
|
|
if(substr($a[1],0,1) == '$')
|
2011-03-13 08:51:59 -04:00
|
|
|
continue;
|
|
|
|
$s .= '$a->strings[' . $a[0] . "] = array(\n";
|
|
|
|
$s .= "\t0 => ". $a[0]. ",\n";
|
|
|
|
$s .= "\t1 => ". $a[1]. ",\n";
|
|
|
|
$s .= ");\n";
|
|
|
|
} else {
|
2017-03-21 12:02:59 -04:00
|
|
|
if(substr($a,0,1) == '$')
|
2018-01-15 08:05:12 -05:00
|
|
|
continue;
|
2011-03-13 08:51:59 -04:00
|
|
|
$s .= '$a->strings[' . $a . '] = '. $a . ';' . "\n";
|
|
|
|
}
|
2010-09-29 21:11:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
$zones = timezone_identifiers_list();
|
2017-03-21 12:02:59 -04:00
|
|
|
foreach($zones as $zone)
|
2010-09-29 21:11:23 -04:00
|
|
|
$s .= '$a->strings[\'' . $zone . '\'] = \'' . $zone . '\';' . "\n";
|
2018-01-15 08:05:12 -05:00
|
|
|
|
2010-09-29 21:11:23 -04:00
|
|
|
echo $s;
|