Skip to content

Kris-Driv/Localizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

Localizer

Simple to use translate package for PocketMine-MP

###Loading languages

Localizer::loadLanguages($this->getDataFolder() . "languages");

or

$localizer = new Localizer('en', $this->getDataFolder(). "languages");

Localizer class provides a helper function to copy folder with its contents to destination folder. It's used to transfer default language files from plugin to resource folder.

###Using

Get english text under key 'line' from file example

$localizer->get('example.line');

Pointing to file is redundant if the key is unique in the language so you can simply call $localizer->get('line')

Every Localizer object is saved into static variable in Localizer class and manage them with static functions

Localizer::trans('line')

If you don't provide locale code then Localizer::DEFAULT_LANGUAGE ("en") will be used. Also you can use this method

Localizer::en('line');

Each of functions above accepts these next two arguments: ..., array $params = [], string $default = null

###Example: See this example

About

Simple to use translate package for PocketMine-MP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages