Multi-language support

This commit is contained in:
bergware
2020-05-15 10:26:33 +02:00
parent 4268d43891
commit ee7946743c
+1 -1
View File
@@ -27,7 +27,7 @@ function parse_help_file($file) {
return preg_replace(['/^$/m','/^([^:;].+)$/m','/^:(.+_help):$/m','/^:end$/m'],['>','>$1','_$1_="','"'],str_replace(["\"\n",'"'],["\" \n",'\"'],file_get_contents($file)));
}
function parse_text($text) {
return preg_replace_callback('/_\((.+?)\)_/m',function($m){return _($m[1]);},preg_replace(["/^:(.+_help):$/m","/^:(.+_plug):$/m","/^:end$/m"],["<?translate(\"_$1_\");?>","<?if (translate(\"_$1_\")):?>","<?endif;?>"],$text));
return parse_ini_string(preg_replace_callback('/_\((.+?)\)_/m',function($m){return _($m[1]);},preg_replace(["/^:(.+_help):$/m","/^:(.+_plug):$/m","/^:end$/m"],["<?translate(\"_$1_\");?>","<?if (translate(\"_$1_\")):?>","<?endif;?>"],$text)));
}
function parse_file($file,$markdown=true) {
return $markdown ? Markdown(parse_text(file_get_contents($file))) : parse_text(file_get_contents($file));