GoldenEye: Source Forums

  • June 20, 2019, 12:36:22 am
  • Welcome, Guest
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: Concatenating a translation string with another string  (Read 2862 times)

0 Members and 1 Guest are viewing this topic.

Joe

  • Secret Agent
  • **
  • Posts: 139
  • Reputation Power: 54
  • Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.
  • Offline Offline
Concatenating a translation string with another string
« on: April 08, 2014, 11:14:39 am »

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: [Select]
            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)

Instead of displaying "Your resurrection queue position is: 1",  "#GES_GP_DAD_RESURRECTION_QUEUE_POSITION1" is displayed.
Logged
Free games:FPS + RTS: Renegade X & Battlezone 1.5,RTS: 7 Kingdoms & Open Red Alert, TBS:Hedgewars, playcatan.com & www.wesnoth.org

killermonkey

  • GES Programmer
  • Retired Lead Developer
  • GE:S Fanatic
  • *
  • Posts: 5,473
  • Reputation Power: 345
  • killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!
  • Offline Offline
    • DroidMonkey Apps
Re: Concatenating a translation string with another string
« Reply #1 on: April 08, 2014, 12:29:04 pm »

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: [Select]
from Utils import _

localizer = _("#GES_GP_DAD_RESURRECTION_QUEUE_POSITION", 1)
« Last Edit: April 08, 2014, 12:31:12 pm by killermonkey »
Logged

Joe

  • Secret Agent
  • **
  • Posts: 139
  • Reputation Power: 54
  • Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.Joe has an aura about them.
  • Offline Offline
Re: Concatenating a translation string with another string
« Reply #2 on: April 09, 2014, 02:41:20 am »

Thanks KillerMonkey
Logged
Free games:FPS + RTS: Renegade X & Battlezone 1.5,RTS: 7 Kingdoms & Open Red Alert, TBS:Hedgewars, playcatan.com & www.wesnoth.org
Pages: [1]   Go Up