Messages in multiplayer are translated by host before they are sent to client

Bug #702011 reported by Hans Joachim Desserud
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Medium
Unassigned

Bug Description

Steps to reproduce:
1. Start two instances of Widelands by running "./widelands --double". Let's call them A and B.
2. Go to options in A and change "Language", so that A and B now have different languages.
3. In A, go to multiplayer and host a local game.
4. In B, go to multiplayer and join the local game (specify 127.0.0.1 as the IP-addresse).
5. When B joins the game, the message "B has joined the game" is added to the chat.

Expected result:
Since A and B use different languages, the message should be displayed in the language the player has set Widelands to use.

Actual result:
The text is shown in the language chosen by A (host of the game).

I assume the way it works is that the message is translated/posted on the host side and then sent to the client(s). This is a minor annoyance though, but could be problematic depending on the different languages used, since it is in essence printing messages in a language the player may not know.
If the text is translated before it is sent, as seems to be the case, it doesn't seem to be an easy fix to this, if it is at all possible.

Other things such as map names, and other information is translated fine, this is only limited to messages sent over the chat system.

tags: added: internationalization multiplayer
Revision history for this message
Nasenbaer (nasenbaer) wrote :

this is known.

One way to fix this, would be to put the messages in numbered arrays and than only send the numbers -> read + translate the strings from the arrays.
however it's a bit more complex, as some strings are more complex, e.g. a string in a string, so we would need a bunch of new network commands.

Changed in widelands:
milestone: none → build17-rc1
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

This was recently rereported. A short summary of duplicate bug 807907:

Currently messages by the host are translated on host side using the hosts localisation.
First i thought we should create a table with id's an messages so the host would only send the id and the clients would read the matching message from the list and translate it. Anyway this has two disadvantages:
1. The code gets less readable and you would have to search through the list every time you want to check what kind of message the host sends at a specific place. Using enumeration might help here. You would still have a table of messages, but the source code would look something like send_message(player_joined) instead of send_message(3).
2. If host and client use a different version (might be even if only slightly), the list may be incomplete and therefor some messages would not be translateable - e.g. if a new "sorry you use a different version, you can not play on this server" message would be added ... ;)

Therefor it's perhaps a good idea to save the localisation of all clients on host side, translate the messages (if possible) on host side and send the translated messages to the clients. if the clients use different localisation and a message is system wide, the host should keep the message in english.

tags: added: network
Revision history for this message
SirVer (sirver) wrote :

Btw, comercial games have the same problem. The blizzard games for example send localised strings over the network; so if I play with my polish buddy and someone drops out of the game, I get a polish message from him (when he hosts the game).

Translating on the server might not be possible as some people will only have localized messages for their own language. I agree that there could be problems with a lookup table, but one could also do something like that:

1) host sends id of msg to display (including english text, then points 4 is not needed)
2) if id is known, client will localize it and display it
3) if id is not known, client ask host for english text (or simply displays it, if it was send in the original msg)
4) host sends english string and client displays it instead (maybe also showing a warning that the versions are not aligned).

Revision history for this message
Nasenbaer (nasenbaer) wrote :

concerning #3: this seems like a good idea, however what about messages with more parts? like:
format("Player %s got disconnected because of %s!" % PlayerName % Reason()).str(); ???

Revision history for this message
SirVer (sirver) wrote :

I would strongly suggest to limit those cases. For example, the only "argument" I would allow for strings is the player name. That means that all possible 'reasons' for disconnecting should get their own message and obviously a "reason not full clear" message. The communication protocol could then make a distinction between messages with argument and without. This keeps things a little less convoluted.

Nasenbaer (nasenbaer)
Changed in widelands:
assignee: nobody → Nasenbaer (nasenbaer)
Revision history for this message
Nasenbaer (nasenbaer) wrote :

Fixed in rev. 6239 of lp:~widelands-dev/widelands/ggz-replacement .
Marked this report as Fix committed, as that branch will soon be merged to trunk.

The reason why I pushed that to that branch instead to trunk simply is, because a NETWORK_PROTOCOL_VERSION increase was needed, as well as by the other changes in that branch - therefore we just need one increase...

Changed in widelands:
status: Confirmed → Fix Committed
Revision history for this message
SirVer (sirver) wrote :

Released in build17-rc1.

Changed in widelands:
status: Fix Committed → Fix Released
Revision history for this message
GunChleoc (gunchleoc) wrote :

This has regressed.

Changed in widelands:
status: Fix Released → Confirmed
assignee: Nasenbaer (nasenbaer) → GunChleoc (gunchleoc)
Revision history for this message
GunChleoc (gunchleoc) wrote :

I can't reproduce the problem any more, so setting this back to Fix Released.

Changed in widelands:
status: Confirmed → Fix Released
assignee: GunChleoc (gunchleoc) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.