Move resources/locale to Composer dependency

all remaining submodules are now non-essential to running a server.
They are also versioned and updates can be done automatically using 'composer update'.

Finally, we can also put an end to the issue of translations being rendered incorrectly or being missing due to outdated submodules.
This commit is contained in:
Dylan K. Taylor 2021-11-06 00:32:58 +00:00
parent dbf9a33160
commit 3c754b079c
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
7 changed files with 29 additions and 8 deletions

3
.gitmodules vendored
View File

@ -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

View File

@ -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);

View File

@ -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",

25
composer.lock generated
View File

@ -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",

@ -1 +0,0 @@
Subproject commit f9076e4a6e3049aeaf7abd30d39a482a1392eafe

View File

@ -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');

View File

@ -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);