Notification log translations are in opponent's language

Game development with Board Game Arena Studio
Post Reply
QWERTY_Already_Taken
Posts: 5
Joined: 10 March 2021, 06:55

Notification log translations are in opponent's language

Post by QWERTY_Already_Taken »

Hi! I'm a developer here. I've tried different things including the right way of translating log texts, but I was informed that the log texts are translated in the active player's language. I even got an image from a player and it doesn't make sense to me.

Player's image:
(The player put the arrows and labels on the image, but it seems there are different languages up there based on who is the active player)
Image

Here is one section of the offending code:

from material.inc.php

Code: Select all

$this->slots = array(
   "1x1" => self::_("left-high-post"),
   "1x2" => self::_("left-high"),
   ...
);
from penaltychallenge.game.php

Code: Select all

$slot_name = $this->slots[$slot_n];
self::notifyAllPlayers( 'shooter_aim', clienttranslate( 'The shooter aims for <b>${slot_name}<b>' ), array(
   'slot_name' => $slot_name
) );
I would be really grateful if someone can help me and tell me what I did wrong.
User avatar
ufm
Posts: 2039
Joined: 06 January 2017, 08:38

Re: Notification log translations are in opponent's language

Post by ufm »

This question should be posted on developer category: viewforum.php?f=12
User avatar
robinzig
Posts: 459
Joined: 11 February 2021, 18:23

Re: Notification log translations are in opponent's language

Post by robinzig »

Definitely should be in the developer forum, but since I'm here and the solution is obvious / simple:

Your material.inc.php needs to use clienttranslate rather than self::_ for anything that might get sent to the client side.
User avatar
Een
Posts: 3861
Joined: 16 June 2010, 19:52

Re: Notification log translations are in opponent's language

Post by Een »

I have moved this topic to the developer forum.

In addition to robinzig's answer, please note that you'll need to list substituted clientranslate strings in the "i18n" parameter array of your notifications for translation to apply.
QWERTY_Already_Taken
Posts: 5
Joined: 10 March 2021, 06:55

Re: Notification log translations are in opponent's language

Post by QWERTY_Already_Taken »

Thank you all! I'll try it out. Sorry I posted this in the wrong place
Post Reply

Return to “Developers”