[mod] Translate chat using commands [babelfish]

User avatar
taikedz
Member
 
Posts: 640
Joined: Sun May 15, 2016 11:11
Location: Scotland, UK
GitHub: taikedz
IRC: DuCake
In-game: DuCake

[mod] Translate chat using commands [babelfish]

by taikedz » Sun Dec 18, 2016 00:13

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
Last edited by taikedz on Fri Mar 02, 2018 16:15, edited 10 times in total.
Not my monkeys; not my circus.
 

User avatar
DS-minetest
Member
 
Posts: 1026
Joined: Thu Jun 19, 2014 19:49
Location: in front of my pc (which is at home)
GitHub: DS-Minetest
In-game: DS

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

by DS-minetest » Sun Dec 18, 2016 09:35

nice!
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

User avatar
taikedz
Member
 
Posts: 640
Joined: Sun May 15, 2016 11:11
Location: Scotland, UK
GitHub: taikedz
IRC: DuCake
In-game: DuCake

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

by taikedz » Sun Dec 18, 2016 13:56

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 ....
Not my monkeys; not my circus.
 

User avatar
taikedz
Member
 
Posts: 640
Joined: Sun May 15, 2016 11:11
Location: Scotland, UK
GitHub: taikedz
IRC: DuCake
In-game: DuCake

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

by taikedz » Fri Feb 03, 2017 22:22

** 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.
Not my monkeys; not my circus.
 

User avatar
octacian
Member
 
Posts: 593
Joined: Mon Dec 21, 2015 22:18
Location: BC, Canada
GitHub: octacian
IRC: octacian
In-game: octacian
 

User avatar
DS-minetest
Member
 
Posts: 1026
Joined: Thu Jun 19, 2014 19:49
Location: in front of my pc (which is at home)
GitHub: DS-Minetest
In-game: DS

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

by DS-minetest » Tue Mar 21, 2017 14:17

This mod could be made clientside.
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

User avatar
octacian
Member
 
Posts: 593
Joined: Mon Dec 21, 2015 22:18
Location: BC, Canada
GitHub: octacian
IRC: octacian
In-game: octacian

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

by octacian » Tue Mar 21, 2017 14:46

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.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
 

User avatar
taikedz
Member
 
Posts: 640
Joined: Sun May 15, 2016 11:11
Location: Scotland, UK
GitHub: taikedz
IRC: DuCake
In-game: DuCake

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

by taikedz » Tue Mar 21, 2017 17:16

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.
Last edited by taikedz on Tue Mar 21, 2017 19:53, edited 1 time in total.
Not my monkeys; not my circus.
 

User avatar
azekill_DIABLO
Member
 
Posts: 7460
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO

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

by azekill_DIABLO » Tue Mar 21, 2017 19:02

Good Jab Tai! (can i call you like this idk to write your name)

it might be very useful forinternational servers!
 

User avatar
taikedz
Member
 
Posts: 640
Joined: Sun May 15, 2016 11:11
Location: Scotland, UK
GitHub: taikedz
IRC: DuCake
In-game: DuCake

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

by taikedz » Tue Mar 21, 2017 19:09

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 ;-)
Not my monkeys; not my circus.
 

User avatar
azekill_DIABLO
Member
 
Posts: 7460
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

User avatar
taikedz
Member
 
Posts: 640
Joined: Sun May 15, 2016 11:11
Location: Scotland, UK
GitHub: taikedz
IRC: DuCake
In-game: DuCake

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

by taikedz » Sat Apr 15, 2017 09:55

[comment deleted]
Last edited by taikedz on Tue Aug 01, 2017 08:01, edited 1 time in total.
Not my monkeys; not my circus.
 

Sporax
Member
 
Posts: 124
Joined: Mon Jul 11, 2016 16:33
Location: France
GitHub: Sporax
IRC: Sporax
In-game: Sporax

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

by Sporax » Mon May 01, 2017 17:50

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? :)
 

User avatar
taikedz
Member
 
Posts: 640
Joined: Sun May 15, 2016 11:11
Location: Scotland, UK
GitHub: taikedz
IRC: DuCake
In-game: DuCake

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

by taikedz » Wed May 24, 2017 13:24

quick note to say this was fixed in commit/bea880cf .... I simply forgot to update this post :-/
Not my monkeys; not my circus.
 

User avatar
taikedz
Member
 
Posts: 640
Joined: Sun May 15, 2016 11:11
Location: Scotland, UK
GitHub: taikedz
IRC: DuCake
In-game: DuCake

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

by taikedz » Wed Aug 02, 2017 12:52

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...)
Not my monkeys; not my circus.
 

User avatar
azekill_DIABLO
Member
 
Posts: 7460
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 


Return to Mod Releases



Who is online

Users browsing this forum: Dan2018, Google [Bot], twoelk and 2 guests