[Last Droids]Translations are not applied to the log

BGA localization discussions
Post Reply
User avatar
JudgeWhyMe
Posts: 36
Joined: 08 August 2012, 17:14

[Last Droids]Translations are not applied to the log

Post by JudgeWhyMe »

Hello

In that game, the log on the right side is not translated, and I don't know why
Image

What I do:
$prompt = clienttranslate("Message to be displayed {var}");
$prompt = str_replace("{var}", var_value, $prompt);
$this->notify->all("message", strval($prompt ), [] );

Am I doing something wrong?

I checked in translation HQ, the strings that are in the log appears there and are translated
Image

Thanks
User avatar
Thomas
Posts: 364
Joined: 10 January 2012, 14:37

Re: [Last Droids]Translations are not applied to the log

Post by Thomas »

This is the forum for translations, not for development, maybe you ask your question at https://boardgamearena.com/forum/viewforum.php?f=12 to reach experienced developers.

I have no experience with BGA development, but I found an example for translating texts with variables. Maybe that helps:

clienttranslate_('First part of the string, ${argument} second part of the string'), ['argument' => $argument ]

See https://en.doc.boardgamearena.com/Translations for more details on developing and translation.
User avatar
tchobello
Posts: 693
Joined: 18 March 2012, 13:19

Re: [Last Droids]Translations are not applied to the log

Post by tchobello »

JudgeWhyMe wrote: 02 December 2025, 14:46 Hello

In that game, the log on the right side is not translated, and I don't know why

What I do:
$prompt = clienttranslate("Message to be displayed {var}");
$prompt = str_replace("{var}", var_value, $prompt);
$this->notify->all("message", strval($prompt ), [] );

Am I doing something wrong?

I checked in translation HQ, the strings that are in the log appears there and are translated
Image

Thanks
try using $var_value...
User avatar
Kayvon
Posts: 1059
Joined: 17 October 2011, 01:39

Re: [Last Droids]Translations are not applied to the log

Post by Kayvon »

Developer here. That's not the correct way to do notification, which is why nothing is being translated.

$name_of_card = clienttranslate('Ace of Spaces');
$this->notify->all("message", strval(clienttranslate('You just played the card ${cardname}'), [
"i18n" => ["cardname"],
"cardname" => $name_of_card,
] );

Of course, it's even simpler if you don't need to translate the argument.

$value = 5;
$this->notify->all("message", strval(clienttranslate('You lose ${num} health'), [
"num" => $value,
] );

---

Instead, you're signalling that $prompt should be translated, but then you're sending a string that's different than $prompt. $prompt is a portion of that string, but it doesn't automatically translate small portions. That would break a lot of stuff.
Post Reply

Return to “Translations”