Changes between Version 1 and Version 3 of Ticket #6451


Ignore:
Timestamp:
Mar 9, 2022, 1:27:14 AM (2 years ago)
Author:
bb
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6451

    • Property Patchphab:D4530
    • Property Component Internationalization & LocalizationCore engine
    • Property Summary Em-dash sprinf combination crashSingle word wrapping infinite loop
  • Ticket #6451 – Description

    v1 v3  
    1 Currently (r26604) when I select the en_GB language and open the replay menu, the game will hang, eat up all RAM and crash. This behaviour is confirmed by marder while not reproducible by Freagarach.
     1Currently (r26604) when I select the en_GB language and open the replay menu, the game will hang, eat up all RAM and crash.
    22
    3 Trisecting the issue lead to the following string `"%(min)s - %(max)s min"` in the durationFilters of the replayMenu. In en_GB this is translated as `"%(min)s–%(max)s min"`. Notice the em_dash directly between two sprintf variables, both of which will be replaced by a number.
    4 So after doing the sprintf, we will end up with a translated string like `"30\u201345 min"`. Here `\u2013` is the unicode for the em-dash and 30 and 45 are the numbers plugged into the string.
     3Trisecting the issue lead to the following string `"%(min)s - %(max)s min"` in the durationFilters of the replayMenu. In en_GB this is translated as `"%(min)s–%(max)s min"`. Notice the em_dash directly (no spaces) between two sprintf variables, both of which will be replaced by a number.
    54
    6 Our poor textRenderer fails miserably at interpreting `30\u201345`. Yielding the behaviour as described.
     5The resulting string is too long for the textbox, however since there are no spaces, we cannot word-warp either.
    76
    8 This issue can easily be fixed by changing the translation and adding some spaces around the em-dash, but that is nowhere near a permanent solution.
     7Since r26522 we have the crash as described.
    98
    10 Seeing that Freagarach doesn't have this issue, this potentially is a platform depended bug. This might as well be a bug in a third party dependency.
     9Before r26522 this issue was hided by blindly adding a full width of the word in case of failure. Notice this is wrong because we could end up with wrapping "too late" (there could be a short word following the long word which stays on the same line this way).
     10
     11Instead we should not process the line on the first word of the line (unless it is the last word of the string).
     12
     13This issue could also be fixed by changing the translation and adding some spaces around the em-dash, but that is nowhere near a permanent solution.