Translations in descriptionMyTurn
Posted: 02 November 2026, 19:02
I am having troubles translating the 'description' and 'descriptionMyTurn'.
As you can see here in this state depending if the player can pass I want to show a message or another, but in Production(my game Catopomp is currently in Beta) the $message and $messageMyTurn is shown always in English mixed with the translation of the first part of the sentence.
In the documentation I found some examples for i18n but they are focused on sending notifications.
Could someone point me in the right direction?
Thank you
As you can see here in this state depending if the player can pass I want to show a message or another, but in Production(my game Catopomp is currently in Beta) the $message and $messageMyTurn is shown always in English mixed with the translation of the first part of the sentence.
In the documentation I found some examples for i18n but they are focused on sending notifications.
Could someone point me in the right direction?
Thank you
Code: Select all
class TransferHellCard extends GameState {
function __construct(protected Game $game) {
parent::__construct($game,
id: 7,
type: StateType::ACTIVE_PLAYER,
description: clienttranslate('Since ${actplayer} have ${message} (${otherplayer})'),
descriptionMyTurn: clienttranslate('Since ${you} have ${messageMyTurn} (${otherplayer})'),
transitions: [
'transferCard' => 4,
],
updateGameProgression: false,
initialPrivate: null,
);
}
function getArgs(): array {
$hell = $this->game->getPlayerCards((int)$this->game->getActivePlayerId(), "hell");
$passingPlayer = array_values($this->game->getPlayerWhoIsPassingTurn());
$canPass = count($hell) < 3;
if ($canPass) {
$message = clienttranslate('less than 3 Hell cards, they can transfer one Hell card to the player who passed on their set');
$messageMyTurn = clienttranslate('less than 3 Hell cards, you can transfer one Hell card to the player who passed on your set');
}
else {
$message = clienttranslate('≥ 3 Hell cards, they must transfer one Hell card to the player who passed on their set');
$messageMyTurn = clienttranslate('≥ 3 Hell cards, you must transfer one Hell card to the player who passed on your set');
}
return [
'canPass' => $canPass,
'isTransferPassingMode' => true,
'message' => $message,
'messageMyTurn' => $messageMyTurn,
'otherplayer'=> count($passingPlayer) > 0 ? $passingPlayer[0]['player_name'] : '',
'otherplayer_id'=> count($passingPlayer) > 0 ? $passingPlayer[0]['player_id'] : ''
];
}