server
server copied to clipboard
Improve localization of server messages
The server sends a number of messages as strings in English. It would be better to send only command representations or maybe localization keys. In some cases the messages might even be moved completely to the client and not sent by the server at all.
For instance if a user is banned, the server will send the client a message like this:
{
'command': 'notice',
'style': 'error',
'text': 'You have been banned from FAF...'
}
However it would be better if the server sent something like this and let the client do the localization:
{
'command': 'authentication_failed',
'context': 'ban',
'expiry_date': '2019-06-06 17:13:24.422804'
}
Some examples of messages which might be removed completely can be found in LadderService.inform_player
. The server will send a lengthy explanation of the matchmaker to new players. This message could probably be moved entirely to the client, and not need a server trigger at all.
Messages
Here are some messages which I suggest we localize in the client:
High priority:
https://github.com/FAForever/server/blob/51847b7c2f61d1c6e78492b22e3d8b7f798ad1c3/server/lobbyconnection.py#L418
https://github.com/FAForever/server/blob/51847b7c2f61d1c6e78492b22e3d8b7f798ad1c3/server/lobbyconnection.py#L557
https://github.com/FAForever/server/blob/51847b7c2f61d1c6e78492b22e3d8b7f798ad1c3/server/lobbyconnection.py#L631
https://github.com/FAForever/server/blob/51847b7c2f61d1c6e78492b22e3d8b7f798ad1c3/server/lobbyconnection.py#L636
https://github.com/FAForever/server/blob/51847b7c2f61d1c6e78492b22e3d8b7f798ad1c3/server/lobbyconnection.py#L712
Java server code: 119
https://github.com/FAForever/server/blob/51847b7c2f61d1c6e78492b22e3d8b7f798ad1c3/server/lobbyconnection.py#L716
https://github.com/FAForever/server/blob/51847b7c2f61d1c6e78492b22e3d8b7f798ad1c3/server/lobbyconnection.py#L722
https://github.com/FAForever/server/blob/51847b7c2f61d1c6e78492b22e3d8b7f798ad1c3/server/lobbyconnection.py#L778
Medium priority:
Java server code: 100
https://github.com/FAForever/server/blob/51847b7c2f61d1c6e78492b22e3d8b7f798ad1c3/server/lobbyconnection.py#L397
Java server code: 131, 132
https://github.com/FAForever/server/blob/51847b7c2f61d1c6e78492b22e3d8b7f798ad1c3/server/lobbyconnection.py#L411
Java server code: 107, 108, 126
All messages in this function:
https://github.com/FAForever/server/blob/51847b7c2f61d1c6e78492b22e3d8b7f798ad1c3/server/lobbyconnection.py#L457
Low priority:
https://github.com/FAForever/server/blob/51847b7c2f61d1c6e78492b22e3d8b7f798ad1c3/server/lobbyconnection.py#L314 https://github.com/FAForever/server/blob/51847b7c2f61d1c6e78492b22e3d8b7f798ad1c3/server/lobbyconnection.py#L323 https://github.com/FAForever/server/blob/51847b7c2f61d1c6e78492b22e3d8b7f798ad1c3/server/lobbyconnection.py#L692 https://github.com/FAForever/server/blob/51847b7c2f61d1c6e78492b22e3d8b7f798ad1c3/server/lobbyconnection.py#L891
The player has no way to choose his language as of now.
I don't think I explained my idea well enough. I don't mean that the server should "do localization" its self, I meant that it should not send as much English text, and rather send commands containing the information necessary for the client to localize those commands into an appropriate message.
Ah yes, that should have been obvious to me.