PocketTranslate is a plugin for PocketMine-MP v5, designed to facilitate live chat translations within your server using the Google Cloud Translation API. With PocketTranslate, developers can seamlessly integrate translation capabilities into their plugins, enhancing communication and accessibility for players from different linguistic backgrounds.
- Live Chat Translation: Translate messages in real-time within the server chat.
- Multiple Language Support: Translate messages to and from various languages supported by the Google Cloud Translation API.
- Developer-Friendly API: Simple and intuitive API for developers to integrate translation features into their plugins effortlessly.
- PocketMine-MP v5
- Google Cloud Translation API key
- Download the latest release of PocketTranslate from the GitHub repository.
- Place the
PocketTranslate.phar
file into theplugins
directory of your PocketMine-MP server. - Restart or reload your server.
- Generate a Google Cloud Translation API key from the Google Cloud Console.
- Open the
config.yml
file located in theplugin_data/PocketTranslate
directory. - Enter your Google Cloud Translation API key in the
APIKey
field.
use CJMustard1452\translate\ChatTranslateEvent;
/**
* @param string $chatTranslateEvent->getLanguage() The language the message has been translated to.
* @param string $chatTranslateEvent->getContent() The post translated content.
* @param string $chatTranslateEvent->getOrigin() The origin language.
* @param string|null $chatTranslateEvent->getUsername() The players username
*/
public function onTranslate(ChatTranslateEvent $chatTranslateEvent): void {
// handle $chatTranslateEvent
};
English (US) => en
Amharic => am
Arabic => ar
Basque => eu
Bengali => bn
English (UK) => en-GB
Portuguese (Brazil) => pt-BR
Bulgarian => bg
Catalan => ca
Cherokee => chr
Croatian => hr
Czech => cs
Danish => da
Dutch => nl
Estonian => et
Filipino => fil
Finnish => fi
French => fr
German => de
Greek => el
Gujarati => gu
Hebrew => iw
Hindi => hi
Hungarian => hu
Icelandic => is
Indonesian => id
Italian => it
Japanese => ja
Kannada => kn
Korean => ko
Latvian => lv
Lithuanian => lt
Malay => ms
Malayalam => ml
Marathi => mr
Norwegian => no
Polish => pl
Portuguese (Portugal) => pt-PT
Romanian => ro
Russian => ru
Serbian => sr
Chinese (PRC) => zh-CN
Slovak => sk
Slovenian => sl
Spanish => es
Swahili => sw
Swedish => sv
Tamil => ta
Telugu => te
Thai => th
Chinese (Taiwan) => zh-TW
Turkish => tr
Urdu => ur
Ukrainian => uk
Vietnamese => vi
Welsh => cy