I was looking around for free translation engines.
Google Translate offers x amount for free, but then you have to pay for extra, so it wasn't really a candidate.
I heard of something called Apertium, which is basically Machine Translation - using Language Pairs / Key lookups.
I wrote a wrapper for this in Java, currently calling the online free API.
I can then expose this to nwscript.
String spanish = Apertium.getTranslation("eng", "spa","Hello my name is Samuel");
Response Code : 200
{"responseDetails": null, "responseData": {"translatedText": "Hola Mi nombre es Samuel"}, "responseStatus": 200}
It seems pretty accurate with the tests I've done. Its quite responsive, returning the translated test in less than a second. The translation engine is also available for download, so you could even host it locally to the nwserver and just upload the translation keys yourself.
Would be interesting to know if anyone has ever tries implementing in-game translation to facilitate cross-cultural gaming.
Note - just tested installing Apertium locally.
echo "Hello my name is Jonathan" | apertium en-es
On linux console :
Hola Mi nombre es Jonathan
Still quite fast.
Would imagine this could be useful for communities that are heavily Spanish and English mix.
It probably won't be a perfect translation, but it might be a start.
Tried a more complex request
echo "Hello my name is Jonathan, Can I join your party, I am a level 33 sorcerer" | apertium en-es
Hola Mi nombre es Jonathan , Puede uno vuestro partido, soy un nivel 33 *sorcerer
echo "The boss cannot be killed by conventional weapons, you must bless your weapon with holy magic, otherwise the boss will heal every time you strike him." | apertium en-es
El jefe no puede ser matado por armas convencionales, tienes que bendecir vuestra arma con magia santa, *otherwise el jefe se curará cada vez le golpeas.
echo "You take the dragon on the left, I will take the Demons on the right. Let me know if you need potions, I have many." | apertium en-es
Tomas el dragón en el izquierdo, tomaré los Demonios en el correctos. Dejado me saber si necesitas pociones, tengo muchos.
The * seems to indicate phrases / words it has trouble with.
I think something like this could be tweaked and worked into an onPlayerChat hook.
Eg: Player1 is English
Player2 is Spanish
When they speak : If their language's don't match, then the system converts to the appropriate language, and the translation appears as 'SendMessageToPC()' text.
Back to english translation:
echo "Tomas el dragón en el izquierdo" | apertium es-en
You take the dragon in the left