Skip to content

RedMCME/TL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

TL

Translation (i18n) Manager as a virion

Translation

use hook-like

$t = $tl->useTranslation($player->getLocale());
$player->sendMessage($t("message-key"));
$t = $tl->useTranslation($player->getLocale(), "common.prefix"));
$player->sendMessage($t("message-with-params", [
  "count" => 1
]));

use directly

public function translate(string $key, array $params = [], ?string $lang = null, ?string $prefix = null): string;

Get Started

use xerenahmed\TL\TL;

$tl = TL::init();
$tl->load("locales/");

If you use in plugin use the $this->getFile() . "locales/".

"locales" is optional but in this readme we'll use this name as directory.

Directory Tree

locales directory tree should be like this:

.
└── namespace name
    ├── de.json
    ├── en.json
    └── tr.json

in a plugin, this is the recommended way to use it:

.
├── locales
│   └── common
│       ├── de.json
│       ├── en.json
│       └── tr.json
├── plugin.yml
└── src

About

Translation (i18n) Manager as a virion

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages