Fixed installer language strings, bumped MCPE build to 5 (already compatible)

This commit is contained in:
Shoghi Cervantes
2014-06-18 19:22:32 +02:00
parent 89a90c00fd
commit 825656feed
44 changed files with 30 additions and 1079 deletions

View File

@ -31,7 +31,7 @@ use pocketmine\utils\Utils;
class Installer{
const DEFAULT_NAME = "Minecraft: PE Server";
const DEFAULT_PORT = 19132;
const DEFAULT_MEMORY = 128;
const DEFAULT_MEMORY = 256;
const DEFAULT_PLAYERS = 20;
const DEFAULT_GAMEMODE = 0;
@ -52,7 +52,15 @@ class Installer{
}
}while($lang == false);
$this->lang = new InstallerLang($lang);
echo "[*] " . $this->lang->language_has_been_selected . "\n";
if(!$this->showLicense()){
\pocketmine\kill(getmypid());
exit(-1);
}
echo "[?] " . $this->lang->skip_installer . " (y/N): ";
if(strtolower($this->getInput()) === "y"){
return;
@ -67,7 +75,7 @@ class Installer{
$this->endWizard();
}
private function welcome(){
private function showLicense(){
echo $this->lang->welcome_to_pocketmine . "\n";
echo <<<LICENSE
@ -81,8 +89,13 @@ LICENSE;
if(strtolower($this->getInput("n")) != "y"){
echo "[!] " . $this->lang->you_have_to_accept_the_license . "\n";
sleep(5);
exit(0);
return false;
}
return true;
}
private function welcome(){
echo "[*] " . $this->lang->setting_up_server_now . "\n";
echo "[*] " . $this->lang->default_values_info . "\n";
echo "[*] " . $this->lang->server_properties . "\n";
@ -168,13 +181,13 @@ LICENSE;
$config->set("enable-rcon", false);
}
echo "[*] " . $this->lang->usage_info . "\n";
/*echo "[*] " . $this->lang->usage_info . "\n";
echo "[?] " . $this->lang->usage_disable . " (y/N): ";
if(strtolower($this->getInput("n")) === "y"){
$config->set("send-usage", false);
}else{
$config->set("send-usage", true);
}
}*/
$config->save();

View File

@ -47,11 +47,11 @@ class InstallerLang{
private $langfile;
public function __construct($lang = ""){
if(file_exists(\pocketmine\PATH . "src/lang/Installer/" . $lang . ".ini")){
if(file_exists(\pocketmine\PATH . "src/pocketmine/lang/Installer/" . $lang . ".ini")){
$this->lang = $lang;
$this->langfile = \pocketmine\PATH . "src/lang/Installer/" . $lang . ".ini";
$this->langfile = \pocketmine\PATH . "src/pocketmine/lang/Installer/" . $lang . ".ini";
}else{
$l = glob(\pocketmine\PATH . "src/lang/Installer/" . $lang . "_*.ini");
$l = glob(\pocketmine\PATH . "src/pocketmine/lang/Installer/" . $lang . "_*.ini");
if(count($l) > 0){
$files = [];
foreach($l as $file){
@ -62,14 +62,14 @@ class InstallerLang{
$l = key($files);
$l = substr($l, strrpos($l, "/") + 1, -4);
$this->lang = isset(self::$languages[$l]) ? $l : $lang;
$this->langfile = \pocketmine\PATH . "src/lang/Installer/" . $l . ".ini";
$this->langfile = \pocketmine\PATH . "src/pocketmine/lang/Installer/" . $l . ".ini";
}else{
$this->lang = "en";
$this->langfile = \pocketmine\PATH . "src/lang/Installer/en.ini";
$this->langfile = \pocketmine\PATH . "src/pocketmine/lang/Installer/en.ini";
}
}
$this->loadLang(\pocketmine\PATH . "src/lang/Installer/en.ini", "en");
$this->loadLang(\pocketmine\PATH . "src/pocketmine/lang/Installer/en.ini", "en");
if($this->lang !== "en"){
$this->loadLang($this->langfile, $this->lang);
}
@ -82,14 +82,14 @@ class InstallerLang{
public function loadLang($langfile, $lang = "en"){
$this->texts[$lang] = [];
$texts = explode("\n", str_replace(array("\r", "\/\/"), array("", "//"), file_get_contents($langfile)));
$texts = explode("\n", str_replace(array("\r", "\\/\\/"), array("", "//"), file_get_contents($langfile)));
foreach($texts as $line){
$line = trim($line);
if($line === ""){
continue;
}
$line = explode("=", $line);
$this->texts[$lang][array_shift($line)] = str_replace(array("\\n", "\\N",), "\n", implode("=", $line));
$this->texts[$lang][trim(array_shift($line))] = trim(str_replace(array("\\n", "\\N",), "\n", implode("=", $line)));
}
}