TranslateWithBing - Translates chat using Microsoft Azure

This is a discussion topic for the Ore project, TranslateWithBing. View the full project on Ore for downloads and more information.


This is a chat translation service that ties into Microsoft Azure Data Translation Service, aka Bing Translate.

Commands:

  • /language <PlayerOrSource> <Language> - Sets a language for a user, overrides default minecraft locale for translator.
  • /reloadtranslate - reloads the configuration file.

Permissions:

  • translate.command.languageoverride - Permission to use the /language command, defaults to true for User role.
  • translate.command.reload - Permission to use /reloadtranslate command. defaults to true for Admin role.

Config:
Lets you disable the warning sent to users that translations may not be 100% accurate.

SendWarningOnJoin = true

Installation:
In order to use it just copy it to the mods directory on your Sponge server, and sign up for an API key. (Free tier is 2Million characters a month).

On first run it will generate a config file, which must be filled out with the ClientID and ClientSecret you obtained from Microsofts Data Azure Marketplace.

e.g.

#Get your Client ID and Client Secret by signing up for Microsofts Translator Service, Free tier = 2M characters a month.
#https://msdn.microsoft.com/en-us/library/mt146806.aspx
ClientID = "MySpongeyServer"
ClientSecret = "IDQy/Ud4iX7YtRuifXBzh+osnUwsLLk/2KvmQljX21Y="

API Key: Azure AI Translator documentation - quickstarts, tutorials, API reference - Azure AI services | Microsoft Learn

Forums: TranslateWithBing[1.2.0] [API 4.1]

Issues: Issues Ā· RTLSponge/TranslateWithBing Ā· GitHub

Download: Releases Ā· RTLSponge/TranslateWithBing Ā· GitHub

Screenshots:

Changelog:
v1.2.0
New config option: SendWarningOnJoin = true
Added Sponge reload command support.
Updated for SpongeAPI 4.1.0
v1.1.2
Now built for sponge 4.x
v1.1.1
Added a command to reload the config, now tells user the error if an error occurred while setting their language.
v1.0.3
Fixed an issue where TranslateWithBing was ignoring the players override language setting with the command.
v1.0.2
Updated minor version, no features added, but it now no longer needs the libraries it uses on the classpath as it includes them for you in the jar.

1 Like

A few things:

  • Donā€™t use getResource; use the Asset API.
  • When a command fails, you should throw CommandException instead of returning CommandResult.empty().
  • The GameReloadEvent is preferred over a custom reload command.
  • The HOCON spec defines key naming conventions as being all lowercase with hyphens for spaces.
  • registerGettersAndSetters in AbstractData needs to be manually called (itā€™s not done for you).
  • If your DataManipulatorBuilder extends AbstractDataBuilder, then versioning is done for you.

I think I might be aware of the AssetAPI. The code predates the AssetAPI being included.

I donā€™t think we should be using exceptions for what should be handled as control flow, exceptions should be used for exceptional circumstances.

I am using the GameReloadEvent, the reload command is legacy due to already containing it in a previous version.

The code in TranslateWithBing pre-dates AbstractDataBuilder doing this.If I ever need versioning Iā€™ll think about migrating it.

I honestly couldnā€™t care less for HOCON key naming conventions, and Iā€™m not changing it now as it would potentially cause headaches for existing users, not to mention cluttering code over changing the case.

Itā€™s working at the moment, and I am unable to see this mentioned in the javadocs. Iā€™d love you to link to a source, or show me exactly what this is preventing from working before I start making changes to something that works as is.