ReactiveDrop / reactivedrop_public_src

Alien Swarm: Reactive Drop game source code and issue tracker.
https://reactivedrop.com
105 stars 35 forks source link

Vscript function "ClientPrint" could not correctly convert a untranslated string prefixed by TextColor in the chat. #680

Closed IAFJaeger closed 7 months ago

IAFJaeger commented 7 months ago

Execute this Vscript code below: ClientPrint( null, HUD_PRINTTALK, TextColor( 0,0,255 ) + "#rd_challenge_name_asbi" );

We can get the correct translated string in the console: image

Howerver, we get untranslated string in the chat: image

BenLubar commented 7 months ago

This is actually a bug in the console, not the ClientPrint function.

For a translation key to work, it needs to be the entire string. TextColor returns some control characters, so what you need to do here is put the translation key in a separate string and use a formatting parameter to combine it with the text color:

script ClientPrint( null, HUD_PRINTTALK, TextColor( 0, 0, 255 ) + "%s1", "#rd_challenge_name_asbi" );