jdmonin / JSettlers2

Java Settlers project home, downloads, and GPLv3 source code. To download the latest version as a JAR, see https://github.com/jdmonin/JSettlers2/releases/latest .
http://nand.net/jsettlers/
GNU General Public License v3.0
157 stars 63 forks source link

Internationalization difficulties due to function on SOCPlayerInterface #11

Closed lartkma closed 11 years ago

lartkma commented 11 years ago

The print() function on SOCPlayerInterface shows and formats roll messages according to the contents of the message and the currentText, and even the position of specific strings in them. Like #10 this issue makes difficult localization, but this one is more severe because it also expects strings lengths to be a fixed, hardcoded position.

PD: I'm not sure about externalizing to a resources file the `"* "`` part (message format). I've thought on make it customizable for right-to-left languages and similar issues, but probably thinking about it in this moment is a overkill (and can be handled later).

jdmonin commented 11 years ago

You're right, the whole thing with textDisplayRollExpected was sub-optimal. This has been removed: Now, the "Rolled a #" text is generated and printed locally at the client. The server sends only the dice total rolled.

Thank you for the nudge to clean that up; let me know if this works for you.

lartkma commented 11 years ago

Watched commit a283e13968efc7216b5c79efff2081a0d61febc6. As SOCPlayerInterface is not modified in this commit (yet), what is going to happen with it and the textDisplayRollExpected condition in print?

jdmonin commented 11 years ago

I recently committed 516c6c2 . That removes textDisplayRollExpected; instead, the dice roll result message causes SOCPlayerInterface to print the roll result text.

jdmonin commented 11 years ago

Commits 1112f45 and 65a9911 add SOCPlayerInterface.printFormat, and call it where appropriate. This should make it easier to localize things like "Player attacked a pirate fortress (defense 5)".

If you see other places where the string-building needs work, please open new issues here. Thanks again.