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