Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#3979 closed enhancement (fixed)

[PATCH] Use actual playername in singleplayer instead of "You"

Reported by: elexis Owned by: elexis
Priority: Should Have Milestone: Alpha 21
Component: UI & Simulation Keywords: patch
Cc: Patch:


r18161 caused multiple translation issues reported on transifex:

After a short discussion with leper we thought it might be a good idea to not use "You" as the playername in singleplayermode but to let the user chose one.

The attached patch differentiates between single- and multiplayer playername and allows editing them in the options. If the name is blanked, it will resort to the current username of the operating system.

Attachments (1)

t3979_no_you_dont_v1.patch (14.7 KB) - added by elexis 3 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 3 years ago by elexis

If the user saves the settings with a blank playername, it will replace that with the system name on the first gamestart.

It would be better if the name would be replaced right after saving or accepting the options.

It looks like there is no place that actually verifies options.

Currently options.js does no sanity checks at all. Therefore not sure if it would be nice to start doing logic there. Maybe better too many than too few safety checks.

comment:2 Changed 3 years ago by elexis

Furthermore if the user saves an empty string to the options field and starts a game, it will throw the following options error which is corrected by the defaulting mechanism afterwards:

ERROR: Encountered config setting 'playername.multiplayer' without value while parsing 'config/user.cfg' on line 13

Changed 3 years ago by elexis

Attachment: t3979_no_you_dont_v1.patch added

comment:3 Changed 3 years ago by elexis

Owner: set to elexis
Resolution: fixed
Status: newclosed

In 18180:

Use an actual playername instead of "You" in singleplayer, fixes #3979.

Differentiate between SP and MP name and allow editing it in the settings.
Defaults to the OS username.
Makes sharing singleplayer replays more effective.
Also fixes a troublesome colorization of "You" in a translated sentence, refs #3501.

comment:4 Changed 3 years ago by elexis

Keywords: review removed
  • Patch was proposed and reviewed by leper, discussed with sanderd17 and kind of approved by mimo and echotangoecho.
  • A bad translation by itself wouldn't be a sufficient reason to commit this IMO.
  • But the patch makes sharing singleplayer replays more effective as it lists an actual playername in the replay menu instead of "You" everywhere.
  • Though not strictly required, it uses a different name in SP and MP, as suggested by leper (on irc 2016-05-13 13:40 UTC).
  • Notice old configs will keep the old "playername" entry and add "playername.singleplayer" and "playername.multiplayer":
    playername = "elexis3"
    playername.multiplayer = "elexis"
    playername.singleplayer = "elexis"

Both ways of deleting the old one (whitelist (keeping only valid config entries) and blacklist (deleting invalid entries)) seem wrong as one wouldn't be able to reuse the config file with previous (and potentially future) alphas anymore.

comment:5 Changed 3 years ago by elexis

As noted by Yves it also solves some translation issues with the stuff AI sends:

markForTranslation("Here is a gift for %(_player_)s, make a good use of it.");
markForTranslation("I see you are in a bad situation %(_player_)s, I hope this will help."); 
markForTranslation("I can help you this time %(_player_)s, but try to assemble more resources in the future.");
Note: See TracTickets for help on using tickets.