diff --git a/.gitmodules b/.gitmodules index 71a80c00a..0b2349472 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "resources/locale"] - path = resources/locale - url = https://github.com/pmmp/Language.git [submodule "tests/plugins/DevTools"] path = tests/plugins/DevTools url = https://github.com/pmmp/DevTools.git diff --git a/build/generate-known-translation-apis.php b/build/generate-known-translation-apis.php index 04dbe37a6..b2703b513 100644 --- a/build/generate-known-translation-apis.php +++ b/build/generate-known-translation-apis.php @@ -172,7 +172,7 @@ HEADER; echo "Done generating KnownTranslationFactory.\n"; } -$lang = parse_ini_file(Path::join(\pocketmine\RESOURCE_PATH, "locale", "eng.ini"), false, INI_SCANNER_RAW); +$lang = parse_ini_file(Path::join(\pocketmine\LOCALE_DATA_PATH, "eng.ini"), false, INI_SCANNER_RAW); if($lang === false){ fwrite(STDERR, "Missing language files!\n"); exit(1); diff --git a/composer.json b/composer.json index 9c9898693..978a881c4 100644 --- a/composer.json +++ b/composer.json @@ -41,6 +41,7 @@ "pocketmine/classloader": "^0.2.0", "pocketmine/color": "^0.2.0", "pocketmine/errorhandler": "^0.3.0", + "pocketmine/locale-data": "^1.0.3", "pocketmine/log": "^0.4.0", "pocketmine/log-pthreads": "^0.4.0", "pocketmine/math": "^0.4.0", diff --git a/composer.lock b/composer.lock index c6676bc5b..0c3b4eb90 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c0368348f30e5309e979840d1cfad409", + "content-hash": "e36db7fb94bd79034dcc599c3029a621", "packages": [ { "name": "adhocore/json-comment", @@ -531,6 +531,29 @@ }, "time": "2021-02-12T18:56:22+00:00" }, + { + "name": "pocketmine/locale-data", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/pmmp/Language.git", + "reference": "7342b4eb593036c739e7f0c0ed95299ada69ff19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pmmp/Language/zipball/7342b4eb593036c739e7f0c0ed95299ada69ff19", + "reference": "7342b4eb593036c739e7f0c0ed95299ada69ff19", + "shasum": "" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "description": "Language resources used by PocketMine-MP", + "support": { + "issues": "https://github.com/pmmp/Language/issues", + "source": "https://github.com/pmmp/Language/tree/1.0.3" + }, + "time": "2021-11-06T00:27:03+00:00" + }, { "name": "pocketmine/log", "version": "0.4.0", diff --git a/resources/locale b/resources/locale deleted file mode 160000 index f9076e4a6..000000000 --- a/resources/locale +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f9076e4a6e3049aeaf7abd30d39a482a1392eafe diff --git a/src/CoreConstants.php b/src/CoreConstants.php index 91b9b95b9..46e00a2a3 100644 --- a/src/CoreConstants.php +++ b/src/CoreConstants.php @@ -36,4 +36,5 @@ define('pocketmine\_CORE_CONSTANTS_INCLUDED', true); define('pocketmine\PATH', dirname(__DIR__) . '/'); define('pocketmine\RESOURCE_PATH', dirname(__DIR__) . '/resources/'); define('pocketmine\BEDROCK_DATA_PATH', dirname(__DIR__) . '/vendor/pocketmine/bedrock-data/'); +define('pocketmine\LOCALE_DATA_PATH', dirname(__DIR__) . '/vendor/pocketmine/locale-data/'); define('pocketmine\COMPOSER_AUTOLOADER_PATH', dirname(__DIR__) . '/vendor/autoload.php'); diff --git a/src/lang/Language.php b/src/lang/Language.php index f3e966704..33ad93888 100644 --- a/src/lang/Language.php +++ b/src/lang/Language.php @@ -52,7 +52,7 @@ class Language{ */ public static function getLanguageList(string $path = "") : array{ if($path === ""){ - $path = Path::join(\pocketmine\RESOURCE_PATH, "locale"); + $path = \pocketmine\LOCALE_DATA_PATH; } if(is_dir($path)){ @@ -101,7 +101,7 @@ class Language{ $this->langName = strtolower($lang); if($path === null){ - $path = Path::join(\pocketmine\RESOURCE_PATH, "locale"); + $path = \pocketmine\LOCALE_DATA_PATH; } $this->lang = self::loadLang($path, $this->langName);