Mudlet / Mudlet

⚔️ A cross-platform, open source, and super fast MUD client with scripting in Lua
https://mudlet.org
GNU General Public License v2.0
740 stars 267 forks source link

Allow mapping scripts to use language-specific language codes #2692

Closed vadi2 closed 5 years ago

vadi2 commented 5 years ago

Brief summary of issue / Description of requested feature:

Mapping scripts right now only get access to English-language directions. If they want to use some other language, they have to create their own infrastructure for it (like the generic mapping script).

Mudlet should provide translations of directions for mapping scripts to make use of.

Steps to reproduce the issue / Reasons for adding feature:

i18n support for speedwalking on games that don't use English directions for walking.

Error output / Expected result of feature

Super easy way for a mapping script to make use of translated directions.

Extra information, such as Mudlet version, operating system and ideas for how to solve / implement:

Mudlet 3.21

SlySven commented 5 years ago

As far as I see it you will probably want to have some MUD/Game language specific directions both the full words and their abbreviations which can be chosen (and used as placeholders) in a set of line-edits in the profile preferences that allow explicit overrides by the user. The abbreviated forms can then be used by the route-finding code and the full forms used for display in places like the exits control panel on the 2D mapper.

Obviously at least the retrieval of those settings should be possible from the Lua API and there are desirable reasons why they should be settable from there as well...

vadi2 commented 5 years ago

We can't allow custom codes because all strings have to be known to lupdate at translation time, so I'll instead provide the full direction words ("northeast") and their short variants ("ne"). I'll also provide functionality for a script to easily translate a Mudlet speedpath: so all script writers need to do is:

speedwalkpath = translateTable(speedwalkpath)

-- use speedwalkpath just as you did before, no other changes to code needed

What do you think?

Kebap commented 5 years ago

I will reopen this issue as a central overview for feedback etc. The PR has been merged, but needs to have texts translated first, before we can actually test

vadi2 commented 5 years ago

We can test with https://github.com/Mudlet/Mudlet/pull/2664 once it has a recent build. I've entered the Russian translations in.

Kebap commented 5 years ago

You have also entered German translations already: grafik

vadi2 commented 5 years ago

We need to start uploading to Crowdin through a bot account - that wasn't me, that was the Crowdin feature we enabled to auto-translate obvious texts.

vadi2 commented 5 years ago

It seemed to do Spanish too. I only did Russian by hand.

vadi2 commented 5 years ago

Test with:

linux: https://make.mudlet.org/snapshots/3c879b/Mudlet-3.21.0-testing-PR2664-1c5900f-linux-x64.AppImage.tar osx: https://make.mudlet.org/snapshots/2a4213/Mudlet-3.21.0-testing-PR2664-1c5900f.dmg windows: https://ci.appveyor.com/api/buildjobs/g64il83wobfv27it/artifacts/src%2Fmudlet.zip

SlySven commented 5 years ago

Hang on - are you are not confounding the language of the UI with the language that the Mud/Game server uses and the latter cannot be handled (other that perhaps being offered as overrideable defaults) by the settings for the former. E.g. if I wanted to play a French MUD - although my UI would be set for my native language (en_GB) the direction codes that I need to send to the Game server (and use in speedwalking) are not English but French - e.g. not n, ne, e, se, s, sw, w, nw, up, down, in or out but n, ne, e, se, s, so, o, no, haute, bas, dans, dehors - whilst it might be okay to set the English ones as placeholders (on the basis that if I am using the English language so might be playing English MUDS) it must be allowable to set them to something else...

I do not think you can use the main QObject::tr(...) to provide the direction texts - although it might be possible to interrogate a translation (.qm) binary for a translation without having it loaded in to be used automatically but I do not know how that might be done if it can be.

vadi2 commented 5 years ago

Yep, I am, and we've been sitting on this problem for two years with no progress - so this is better than nothing! If we get a Spaniard wanting to play a German MUD that accepts German directions only - a highly unlikely usecase on two points - we'll see about what we can do. Perhaps they can provide their own mudlet.translations data, perhaps we can figure out how to read other languages.

But for the time being this issue was going nowhere at all, there was nobody looking into fixing it, so I came up with a workable solution where native language speakers can use native directions. Which already is an unlikely usecase because most of the games out there accept English directions for movement, even Chinese ones.

vadi2 commented 5 years ago

@Kebap is the testing good to go?

Kebap commented 5 years ago

During release now I did not focus too much on thorough testing, as I assume it will not make 3.22 at all.

To complicate matters even further, I actually stumbled upon different sets of German directions used by different games. So it seems like the user may have to adjust her table of directions after all.

The other idea was thinking how this integrates with the existing (and sometimes shipped with Mudlet) packages like generic mapper, etc. We may need to write up some transition guide to let packagers know how to best take benefit of these additions.

vadi2 commented 5 years ago

It's in 3.22 because the code is merged. I've documented how to make use of this function on the wiki and linked the relevant 'see also' functions.