Page 1 of 1

[mod] Translate chat using commands [babelfish]

Posted: Sun Dec 18, 2016 00:13
by taikedz
License: LGPLv3.0

Requires being added to secure mods config due to making HTTPS calls to external translation service

Dependencies:
- security
- irc (optional)

Download:

github: https://github.com/taikedz-mt/babelfish
ZIP: https://github.com/taikedz-mt/babelfish ... master.zip
  • * Can be extended to use different web APIs
    * Currently uses Yandex to do the translation because it was the only free API I could get.
    * Can be used as an API for other mods
    * You MUST add babelfish to the `secure.trusted_mods` for it to work, as it makes calls out to the Internet.
Chatting

In its simplest form, players can simply do something like

Code: Select all

Hello everybody! %fr
and this will be transmitted to everybody as

Code: Select all

Bonjour tout le monde!
Other features are implemented as commands:

Code: Select all

    /babel {player}
        * Translates the last message from the specified player to your preferred language
        * Only you see the result of this
        * /babel mrGibberish

    /bblang {language}
        * Set your preferred language using a language code
        * Default is English

    /bb {language} {sentence}
        * Broadcasts a message in the target language (French in this case)
        * /bb fr My english sentence

    /bmsg {language} {player} {sentence}
        * Sends a private message to another player in the target language
        * /bmsg es spanishplayer I do not understand you, please use the translation commands

    /bbcodes
        * List the available language codes
Use as an API

Mod creators can leverage babelfish by using

Code: Select all

babel:translate( phrase_to_translate , language_code )
See README for more API notes

Re: [mod] Translate chat using commands [babelfish]

Posted: Sun Dec 18, 2016 09:35
by Desour
nice!

Re: [mod] Translate chat using commands [babelfish]

Posted: Sun Dec 18, 2016 13:56
by taikedz
There are quite a few players of various languages on this server, and the mod is running. First day of it going live it seems to hold up well...

minetest.ducakedhare.co.uk : 30002

(Axinite)

If anyone wants to try it in the wild and feeback ....

Re: [mod] Translate chat using commands [babelfish]

Posted: Fri Feb 03, 2017 22:22
by taikedz
** finally ** got around to fixing the issues preventing me implementing mod security

You can now turn on mod security and this should work fine. Sorry it took a while.

Re: [mod] Translate chat using commands [babelfish]

Posted: Mon Mar 20, 2017 23:03
by octacian
[DELETED]

Someone else was on my computer.

Re: [mod] Translate chat using commands [babelfish]

Posted: Tue Mar 21, 2017 14:17
by Desour
This mod could be made clientside.

Re: [mod] Translate chat using commands [babelfish]

Posted: Tue Mar 21, 2017 14:46
by octacian
In the future, yes, it'd work great client-side. At this point, though, it is best to remain as is. If I remember correctly, client-side MT still is missing and HTTP request API (and may never get one), and it does not have the features to properly intercept chat messages yet.

Re: [mod] Translate chat using commands [babelfish]

Posted: Tue Mar 21, 2017 17:16
by taikedz
I disagree about the client-sidedness of this:

For one, the code reaches out to the wider Internet (over HTTP), requiring privileged access. This is not something you want users to go trust blindly, and I doubt we'll be introducing code-signing on mods anytime soon (because a/ it defeats the paradigm of free modding and b/ nobody will care enough to check what they're accepting to run anyway)

Secondly, the server-side implementation of this ensures that translations happen once and then are broadcast, and it is possible to control what is displayed under what conditions, rather than a user simply spewing out a heap of translations from their client and telling the server who they are for. It's a game server, not an email relay.

Case in point, I'm still working on making it so that a babel-enabled chat message initiated from a sender is received in the right language for the recipient players, and only translating once per language.

There are other threads on the topic solely of client-side scripting, so I will not elaborate here.

Re: [mod] Translate chat using commands [babelfish]

Posted: Tue Mar 21, 2017 19:02
by azekill_DIABLO
Good Jab Tai! (can i call you like this idk to write your name)

it might be very useful forinternational servers!

Re: [mod] Translate chat using commands [babelfish]

Posted: Tue Mar 21, 2017 19:09
by taikedz
Yeah - International servers is the goal for this mod :-)

PS -Et bien sur appelle-moi Tai, c'est encore plus simple qu'un pseudo :-P

PPS - "jab" c'est un poinçon, ou un bonne gauche rapide dans les côtes ;-)

Re: [mod] Translate chat using commands [babelfish]

Posted: Fri Mar 24, 2017 17:50
by azekill_DIABLO
ha. oups. t'as du avoir mal :)

Re: [mod] Translate chat using commands [babelfish]

Posted: Sat Apr 15, 2017 09:55
by taikedz
[comment deleted]

Re: [mod] Translate chat using commands [babelfish]

Posted: Mon May 01, 2017 17:50
by Sporax
Hello taikedz, i find a bug today on Axinite with this mod, i revoked priv shout to a player but he spoke to others thanks to /bb.
He could sent message with this command, can you change that please? :)

Re: [mod] Translate chat using commands [babelfish]

Posted: Wed May 24, 2017 13:24
by taikedz
quick note to say this was fixed in commit/bea880cf .... I simply forgot to update this post :-/

Re: [mod] Translate chat using commands [babelfish]

Posted: Wed Aug 02, 2017 12:52
by taikedz
I've updated babelfish to now have persistent translations !

As an API, persistent translations allow your mod to save a sentence to babelfish, and get translated versions of it back !

For example, a translated signs mod would allow players to write signs ; other players would be able to read them in their own language. For every language, a translation is stored, so that the item is only translated once. (If the sign is edited, it should clear the translations from the database...)

Re: [mod] Translate chat using commands [babelfish]

Posted: Thu Aug 03, 2017 12:37
by azekill_DIABLO
it's a particularly awesome mod!