MT-CTF / capturetheflag

Capture the Flag game using the Minetest Voxel Engine
https://ctf.rubenwardy.com
82 stars 89 forks source link

babel, utf8_simple: Add in-game translator mod from JMA and a small library for handling UTF-8 text. #1285

Closed markopetrovi closed 4 months ago

markopetrovi commented 5 months ago

Hello, As promised, here is the pull request for adding the in-game translator mod from JMA, along with it's dependency -> utf8_simple mod that provides a small library for dealing with UTF-8, non-ASCII characters.

utf8_simple is a separate mod because it can potentially be used in many other mods, i.e. it's API is generic and not bound to the translator in any meaningful way. Minetest also does not include built-in UTF-8 Lua API, and as far as I know, there has not been much attention on that issue, necessitating the use of a mod to provide such functionality.

The provided version of the translator mod is a stripped down version from JMA, as to require minimal dependencies. The version on JMA also includes dependencies on filter_caps (to prevent translations with all capital letters emerging), filter (to filter swear words in translation output as well) and discordmt for integration with the Discord bot, making the translator usable on Discord ingame-chat channel as well. If any of these additional functionalities were ever required here, they could be added with another commit.

The translator uses Google Translate API (not to be confused with the Google Cloud Translation API) for it's translation engine.

Thank you for your attention. Best regards, Marko Petrović

farooqkz commented 4 months ago

Hello. I think it's a very good addition to the game. However, doesn't it make sense to add mods as git sub-modules?

markopetrovi commented 4 months ago

If that is how you prefer it to be done, then I could add them as submodules, for sure. I just have one question for this: Does the CTF server pull submodules at the commit referenced in this repository's submodule configuration, or does it pull the latest version of the submodule's default (master) branch?

LoneWolfHT commented 4 months ago

This PR should be made to https://github.com/MT-CTF/servermods I'll need to get the opinions of the server staff before this goes anywhere though

If that is how you prefer it to be done, then I could add them as submodules, for sure. I just have one question for this: Does the CTF server pull submodules at the commit referenced in this repository's submodule configuration, or does it pull the latest version of the submodule's default (master) branch?

submodules get updated a little while after the master branch on the original repo is updated, unless a crash fix is pushed or something

markopetrovi commented 4 months ago

Thanks for the reply. I did not realize that this repository is used for mods (or that it exists, since it is not listed in .gitmodules here). Anyway, if that is where this pull request should go, I have no problem to send it there.

I'll need to get the opinions of the server staff before this goes anywhere though

Okay, note me about what they have decided, before I proceed with moving this pull request to that other repository then. :)

LoneWolfHT commented 4 months ago

Thanks for the reply. I did not realize that this repository is used for mods (or that it exists, since it is not listed in .gitmodules here). Anyway, if that is where this pull request should go, I have no problem to send it there.

The server runs CTF, plus some mods (servermods) that enhance the experience in ways that don't fit in a singleplayer/LAN game. I try to keep separation when I can

I'll need to get the opinions of the server staff before this goes anywhere though

Okay, note me about what they have decided, before I proceed with moving this pull request to that other repository then. :)

I've asked, and the answer is no, with practicality/reliability being a big reason. I'm sorry for the work you've put in so far

I would personally prefer a CSM implementation I could refer players to, one idea being a CSM that shows the chat in a formspec, with selectable text you can then copy into a translator, or buttons that print translate links to chat, or even just an automatic link after every message in the chat https://translate.google.com/?sl=en&tl=pt&text=they%20are%20taking%20our%20flag&op=translate image

By the way: with suggestions on the discord I subtract the amount of 'X's from the amount of stars, and if the result isn't greater than ~10 it probably will be hard to get merged image

farooqkz commented 4 months ago

@LoneWolfHT What do you think about CTF's own LibreTranslate instance?

LoneWolfHT commented 4 months ago

@LoneWolfHT What do you think about CTF's own LibreTranslate instance?

The issue is with non-human translators (reliability)