mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 20:07:09 +00:00
Language: treat empty translation files the same as missing ones
This commit is contained in:
parent
fb25e05416
commit
456439566b
@ -27,6 +27,7 @@ use pocketmine\utils\Utils;
|
|||||||
use Webmozart\PathUtil\Path;
|
use Webmozart\PathUtil\Path;
|
||||||
use function array_filter;
|
use function array_filter;
|
||||||
use function array_map;
|
use function array_map;
|
||||||
|
use function count;
|
||||||
use function explode;
|
use function explode;
|
||||||
use function file_exists;
|
use function file_exists;
|
||||||
use function is_dir;
|
use function is_dir;
|
||||||
@ -124,7 +125,10 @@ class Language{
|
|||||||
protected static function loadLang(string $path, string $languageCode) : array{
|
protected static function loadLang(string $path, string $languageCode) : array{
|
||||||
$file = Path::join($path, $languageCode . ".ini");
|
$file = Path::join($path, $languageCode . ".ini");
|
||||||
if(file_exists($file)){
|
if(file_exists($file)){
|
||||||
return array_map('\stripcslashes', Utils::assumeNotFalse(parse_ini_file($file, false, INI_SCANNER_RAW), "Missing or inaccessible required resource files"));
|
$strings = array_map('\stripcslashes', Utils::assumeNotFalse(parse_ini_file($file, false, INI_SCANNER_RAW), "Missing or inaccessible required resource files"));
|
||||||
|
if(count($strings) > 0){
|
||||||
|
return $strings;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new LanguageNotFoundException("Language \"$languageCode\" not found");
|
throw new LanguageNotFoundException("Language \"$languageCode\" not found");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user