1. Go to this page and download the library: Download kostamax27/vanillatext library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$texts = $this->texts->forPlayer($player); // same as withLocale($player->getLocale())
$name = $texts->itemName($item);
$name = $texts->blockName($block);
// override the names of a few vanilla items - earlier providers win, key by key
$provider = new ChainLanguageProvider(
new ArrayLanguageProvider(["ru_RU" => ["item.apple.name" => "Яблочко"]]),
new DirectoryLanguageProvider(Path::join($this->getDataFolder(), "texts"))
);
// name custom items - keys are looked up in the same language files
$resolver = new TranslationKeyResolver(VanillaItemKeys::KEYS + ["myplugin:cool_sword" => "item.myplugin.cool_sword.name"]);
$texts = new VanillaText($provider, $resolver, "en_US");
sh
php vendor/kostamax27/vanillatext/tools/download-texts.php --names-only resources/texts en_US ru_RU
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.