Skip to content

Commit

Permalink
Move resources/locale to Composer dependency
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dktapps committed Nov 6, 2021
1 parent dbf9a33 commit 3c754b0
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 8 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion build/generate-known-translation-apis.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ functionify($key) .
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);
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
25 changes: 24 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion resources/locale
Submodule locale deleted from f9076e
1 change: 1 addition & 0 deletions src/CoreConstants.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@
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');
4 changes: 2 additions & 2 deletions src/lang/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)){
Expand Down Expand Up @@ -101,7 +101,7 @@ public function __construct(string $lang, ?string $path = null, string $fallback
$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);
Expand Down

0 comments on commit 3c754b0

Please sign in to comment.