Introduction:
Back in 2016, I made a module by the name of “TranslationService” that allows you to translate text to different languages with the Yandex.Translate API. While the source behind it is extremely simple and small, it’s free to use for anyone that wants to try it and is just here for the sake of simplicity. With Roblox starting to roll out with multi-lingual support, games are also starting to support multiple languages too. While I would highly recommend you find a native speaker for most cases due to a lack of accuracy in machine translation, this module might be necessary in some cases such as translating chat messages.
Update: This module now supports Google Translate and Microsoft Translator with temporary public keys available for use.
Usage:
TranslationService.Translate(
string OriginalPhrase,
string LanguageToTranslateTo,
string LanguageToTranslateFrom, (optional, default = "en")
string Key, (optional, default = nil)
string Service (optional, default = "Yandex", accepts "Yandex", "Google" or "Microsoft")
) -- Returns the translated phrase
TranslationService.Languages.Google -- Returns a table of available languages with Google Translate
TranslationService.Languages.Yandex -- Returns a table of available languages with Yandex.Translate
TranslationService.Languages.Microsoft -- Returns a table of available languages with Microsoft Translator
The module accepts two letter abbreviations of a language or its full name. If I remember correctly, the Yandex.Translate public key used for the module has a limit of 10 million words to be translated per month. Although unlikely to reach this limit, you may find it necessary to get your own key from Yandex.Translate, Microsoft Translator or Google Translate, which you can then pass as the Key
argument.
Examples:
local TranslationService = require(733018661)
print(TranslationService.Translate("Hello, world!", "fr"))
> Bonjour tout le monde!
print(TranslationService.Translate("This is an example.", "Spanish", "English", nil, "Google"))
> Esto es un ejemplo.
Model: