How to create commands with translated description or usage using the PocketMine API in plugins?
In vanilla commands, strings of translation codes such as %pocketmine.command.help.description
are passed. They are references to the lang file in the original PocketMine, and plugins cannot modify them.
When a player executes /help
, the HelpCommand
class concatenates the result of Command::getDescription()
with the help client output format. Then, it is passed to Player::sendMessage
, which passes the string to BaseLang::translateString
and then BaseLang::parseTranslation
, and then internally lookup translations at occurrences of /%[a-zA-Z0-9\.\-]+/
. Throughout this process, it is not possible to add anything, unless the server BaseLang
is replaced.