Download the PHP package kostamax27/vanillatext without Composer
On this page you can find all versions of the php package kostamax27/vanillatext. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package vanillatext
VanillaText
A library for naming vanilla items, blocks and entities in every Minecraft: Bedrock Edition locale in PocketMine-MP.
Features
- Names for 1,700+ items and blocks, every entity, in the 29 locales the vanilla client ships
- Resolves the pre-flattening keys vanilla language files still use (
minecraft:acacia_planksis named bytile.planks.acacia.name) through a bundled index the vanilla client otherwise keeps to itself - Overlays your own translations over vanilla ones key by key
- Works with a single language file just as well as with all of them - the locale argument is optional
Setup
VanillaText ships no language files of its own - they are Mojang's, weigh 800KB a locale, and a virion has nowhere to put
them. Place a copy of resource_pack/texts from Mojang/bedrock-samples
in your plugin's resources/ directory. tools/download-texts.php does this for you - pass locale codes to download
a subset, and --names-only to keep only the keys VanillaText resolves (~150KB a locale).
Usage
One language
A server that answers everyone in the same language needs one .lang file and never passes a locale.
Many languages
VanillaText::fromDirectory() takes a directory of .lang files and a default locale. The default answers whenever a
locale is omitted or is not covered by the directory (Player::getLocale() may report one).
withLocale() returns a copy with another default locale, so a run of lookups for one player does not repeat it.
The copy shares the language files with the original and costs nothing to make. Locales the directory does not cover
leave the default untouched.
Every method returns null for what it cannot name - custom content, Education Edition content, and keys the
language file lacks.
Composition
VanillaText is a thin layer over a LanguageProvider and a TranslationKeyResolver, both of which it exposes as
readonly properties. Compose your own to override or extend what it serves.