Plugin API for translating messages using free or paid translation services

Supported Games

Translation API is a simple, easy-to-use plugin API for translating messages using free or paid translation services.

Supported Services

Google (free)

  • Limits: Not sure the exact figure, but it's pretty limited
  • API key: None! This isn't really an API, it's just scraping a webpage

Google (paid)

  • Limits: 2 million characters per day and 100,000 characters per 100 seconds
  • API key: You can get an API key by creating an application on the console
  • Bonus: Trial $300 credit to spend on Google Cloud Platform over 60 days
  • https://cloud.google.com/translate/

Microsoft (free/paid)

  • Limits: 2 million characters per month on free tier
  • API key: Get an API key by creating an application here
  • https://www.microsoft.com/en-us/translator/business/translator-api/

Yandex (paid)

  • Limits:, see pricing
  • API key: Get an API key by signing up here
  • https://tech.yandex.com/translate/

Note: If you already have a free key, you can continue to utilize that without cost. Yandex simply isn't issuing free keys anymore, only paid.

Configuration

{
  "API key (if required)": "",
  "Translation service": "google"
}

Available translation service options are "google", "microsoft", and "yandex".

For Developers

To call the methods provided by this plugin, your plugin needs to get the plugin reference. You can do this a couple different ways depending on if it optionally depends on it or requires it.

If your plugin requires this plugin and is written in C#, you can use the following at the top of your plugin:

// Requires: TranslationAPI

For C# plugins, you'll need to get the plugin's reference as such:

[PluginReference]
private Plugin TranslationAPI;

Now that you have the plugin reference, you call the provided methods:

TranslationAPI?.Call("Translate", "Hello world!", "en", "auto");

Note: The above examples are not using the optional Action<string> callback parameters. For examples of how to use these, see Chat Translator or other plugins that use this plugin.

API Methods

Translate(string text, string to, string from = "auto", Action<string> callback = null)

Translates text from one language to another another.

MIT License, with distribution exclusivity for uMod.org


Copyright (c) 2020 Wulf


Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:


The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.