Editing and Customization > Modding Help

Concatenating a translation string with another string

(1/1)

Joe:
Hi,

In the soon to be released new version of my GE:S mode (Die Another Day) a HUD progress message will show eliminated players their resurrection queue position instead of this message being rendered by the GEUtil.HudMessage() function.

I don't want to use the "show value" flag because I don't want a max value to be shown so I instead want to use the "only show title" flag.

I've not been able to concatenate the position value with this message's title:


--- Code: ---
            label = "#GES_GP_DAD_RESURRECTION_QUEUE_POSITION"
            position = str(resQueue.index(player) + 1)
           
            GEUtil.InitHudProgressBar(player,
                                      DieAnotherDay.resQueueMessageChannel,
                                      title=label + position, 
                                      flags=GEGlobal.HUDPB_TITLEONLY, x=-1, y=0.75,
                                      color=DieAnotherDay.RQPositionColour)

--- End code ---

Instead of displaying "Your resurrection queue position is: 1",  "#GES_GP_DAD_RESURRECTION_QUEUE_POSITION1" is displayed.

killermonkey:
You need to use the "advanced localization" that we introduced to fix this problem.

"#GES_GP_DAD_RESURRECTION_QUEUE_POSITION\r1"

the \r is a "line break" character that separates the localization string from the data to be inserted.

Alternatively you can use the helper function:


--- Code: ---
from Utils import _

localizer = _("#GES_GP_DAD_RESURRECTION_QUEUE_POSITION", 1)

--- End code ---

Joe:
Thanks KillerMonkey

Navigation

[0] Message Index

Go to full version