How to Mark Dynamic Description for Translation

Game development with Board Game Arena Studio
Grunt_the_Clever
Posts: 24
Joined: 11 October 2020, 21:09

Re: How to Mark Dynamic Description for Translation

Post by Grunt_the_Clever »

I'm seeing what appear to be BGA side errors in the recent errors in production, though I don't know if these players were seeing the same issue or not, but, this is the same function:

Code: Select all

http://boardgamearena.com/9/zener?table=198180321
01/09 02:56:09 [error] [T198105825] [66.131.130.165] [90916388/jaycestmoi] Error with notification service (TIMEOUT) first error (message length = 1118). Automatic retry - /table/t198105825 - dcc9fe6dbea24d394a38d62da22957dc - chooseMandatoryPiece...
01/09 02:56:10 [error] [T198105825] [66.131.130.165] [90916388/jaycestmoi] Error with notification service (TIMEOUT) second error, notification dropped - /table/t198105825 - 0b8905edb0ee69f671f04c049b04474c - chooseMandatoryPiece...
01/09 02:56:10 [error] [T198105825] [66.131.130.165] [90916388/jaycestmoi] Unexpected exception: Error with notification service (TIMEOUT), please retry
Grunt_the_Clever
Posts: 24
Joined: 11 October 2020, 21:09

Re: How to Mark Dynamic Description for Translation

Post by Grunt_the_Clever »

Okay, finally fixed this :). Thanks again for all your help, Tisaac.

I was able to repro the issue in BGA studio using the dummy translations. My JS was hanging because I was trying to use the translated variable to reference a DOM element:

Code: Select all

dojo.style( 'znr_piece_'+notif.args.piece+'_'+notif.args.color, 'z-index', Number( z_index ) + 1 ); 
Where notif.args.piece was what I was translating with i18n. Hence why the JS would just stop executing (but of course the big error banner doesn't show up in production). To fix this, I simply added another variable for i18n to translate in the message and pass piece through untranslated:

Code: Select all

self::notifyAllPlayers( "chooseMandatoryPiece", clienttranslate( '${player_name} chose the ${en_piece}' ), array(
            'player_name' => self::getActivePlayerName(),
            'piece' => $piece,
            'en_piece' => $piece,
            'i18n' => array( 'en_piece' )
        ) );
This now works, with all the statements getting translated and the game not hanging :)
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: How to Mark Dynamic Description for Translation

Post by Tisaac »

Good catch ! I usually try to always name my translated variables $stuff_desc, $stuff_name to avoid this kind of conflict.
Post Reply

Return to “Developers”