◆ __construct()
__construct |
( |
|
$lang = "" | ) |
|
InstallerLang constructor.
- Parameters
-
49 if(file_exists(\
pocketmine\PATH .
"src/pocketmine/lang/Installer/" . $lang .
".ini")){
51 $this->langfile = \pocketmine\PATH .
"src/pocketmine/lang/Installer/" . $lang .
".ini";
54 foreach(
new \DirectoryIterator(\
pocketmine\PATH .
"src/pocketmine/lang/Installer/") as $file){
55 if($file->getExtension() ===
"ini" and substr($file->getFilename(), 0, 2) === $lang){
56 $files[$file->getFilename()] = $file->getSize();
60 if(count($files) > 0){
64 $l = substr($l, 0, -4);
65 $this->lang = isset(self::$languages[$l]) ? $l : $lang;
66 $this->langfile = \pocketmine\PATH .
"src/pocketmine/lang/Installer/" . $l .
".ini";
69 $this->langfile = \pocketmine\PATH .
"src/pocketmine/lang/Installer/eng.ini";
74 if($this->lang !==
"en"){
75 $this->
loadLang($this->langfile, $this->lang);
◆ __get()
- Parameters
-
- Returns
- mixed
131 return $this->
get($name);
◆ get()
get |
( |
|
$name, |
|
|
|
$search = [] , |
|
|
|
$replace = [] |
|
) |
| |
- Parameters
-
| $name | |
array | $search | |
array | $replace | |
- Returns
- mixed
112 if(!isset($this->texts[$this->lang][$name])){
113 if($this->lang !==
"en" and isset($this->texts[
"en"][$name])){
114 return $this->texts[
"en"][$name];
118 }elseif(count($search) > 0){
119 return str_replace($search, $replace, $this->texts[$this->lang][$name]);
121 return $this->texts[$this->lang][$name];
◆ getLang()
◆ loadLang()
loadLang |
( |
|
$langfile, |
|
|
|
$lang = "en" |
|
) |
| |
- Parameters
-
92 $this->texts[$lang] = [];
93 $texts = explode(
"\n", str_replace([
"\r",
"\\/\\/"], [
"",
"//"], file_get_contents($langfile)));
94 foreach($texts as $line){
99 $line = explode(
"=", $line);
100 $this->texts[$lang][trim(array_shift($line))] = trim(str_replace([
"\\n",
"\\N",],
"\n", implode(
"=", $line)));
◆ $languages
◆ chs
Initial value:=> "简体中文",
"zho" => "繁體中文",
"jpn" => "日本語",
"rus" => "Русский",
"ita" => "Italiano",
"kor" => "한국어",
"deu" => "Deutsch",
"fra" => "Français",
"ind" => "Bahasa Indonesia",
"ukr" => "Україна"
]
The documentation for this class was generated from the following file:
- src/pocketmine/wizard/InstallerLang.php