mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 07:39:42 +00:00
Merge branch 'stable'
This commit is contained in:
@@ -58,7 +58,7 @@ class Language{
|
||||
$allFiles = scandir($path, SCANDIR_SORT_NONE);
|
||||
|
||||
if($allFiles !== false){
|
||||
$files = array_filter($allFiles, function($filename){
|
||||
$files = array_filter($allFiles, function(string $filename) : bool{
|
||||
return substr($filename, -4) === ".ini";
|
||||
});
|
||||
|
||||
@@ -133,7 +133,7 @@ class Language{
|
||||
*/
|
||||
public function translateString(string $str, array $params = [], ?string $onlyPrefix = null) : string{
|
||||
$baseText = $this->get($str);
|
||||
$baseText = $this->parseTranslation(($baseText !== null and ($onlyPrefix === null or strpos($str, $onlyPrefix) === 0)) ? $baseText : $str, $onlyPrefix);
|
||||
$baseText = $this->parseTranslation(($onlyPrefix === null or strpos($str, $onlyPrefix) === 0) ? $baseText : $str, $onlyPrefix);
|
||||
|
||||
foreach($params as $i => $p){
|
||||
$baseText = str_replace("{%$i}", $this->parseTranslation((string) $p), $baseText, $onlyPrefix);
|
||||
|
Reference in New Issue
Block a user