Added KnownTranslationFactory and use it in as many places as possible

this makes translation usage much more statically analysable.
The only places this isn't used are:
- places that prefix translations with colours (those are still a problem)
- places where server/client translations don't match (e.g. gameMode.changed accepts different parameters in vanilla than in PM)
This commit is contained in:
Dylan K. Taylor
2021-08-10 14:50:40 +01:00
parent d39080c45a
commit 2293bd948d
52 changed files with 2185 additions and 372 deletions

View File

@@ -25,8 +25,8 @@ namespace pocketmine\command\defaults;
use pocketmine\command\CommandSender;
use pocketmine\command\utils\InvalidCommandSyntaxException;
use pocketmine\lang\KnownTranslationFactory;
use pocketmine\lang\KnownTranslationKeys;
use pocketmine\lang\TranslationContainer;
use pocketmine\permission\DefaultPermissionNames;
use function array_slice;
use function count;
@@ -54,7 +54,7 @@ class TitleCommand extends VanillaCommand{
$player = $sender->getServer()->getPlayerByPrefix($args[0]);
if($player === null){
$sender->sendMessage(new TranslationContainer(KnownTranslationKeys::COMMANDS_GENERIC_PLAYER_NOTFOUND));
$sender->sendMessage(KnownTranslationFactory::commands_generic_player_notFound());
return true;
}
@@ -97,7 +97,7 @@ class TitleCommand extends VanillaCommand{
throw new InvalidCommandSyntaxException();
}
$sender->sendMessage(new TranslationContainer(KnownTranslationKeys::COMMANDS_TITLE_SUCCESS));
$sender->sendMessage(KnownTranslationFactory::commands_title_success());
return true;
}