Internationalization of lists in notification logs

Game development with Board Game Arena Studio
Post Reply
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Internationalization of lists in notification logs

Post by pikiou »

How can I pass to notifyAllPlayers a list of expressions each of which needs translation ?
The best I could do is this:

Code: Select all

$list = Array(clienttranslate('Town Estate'), clienttranslate('Cloister Church'), clienttranslate('Estate'));  // Maxed at 5 elements
$argList = $list + array_fill(0, 5, '');
$i18n = Array('i18n' => array_keys($list));
self::notifyAllPlayers('voidNotification', clienttranslate('Some text: ${0}, ${1}, ${2}, ${3}, ${4}'), $argList + $i18n);
And it outputs this: "Some text: Town Estate, Cloister Church, Estate, ,"
(Yes these are Ora & Labora buildings, no I'm not working no it)
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: Internationalization of lists in notification logs

Post by sourisdudesert »

Good answer:

self::notifyAllPlayers('voidNotification', clienttranslate('Some text: ${0}, ${1}, ${2}, ${3}, ${4}'), array(
'i18n' => array( '0', '1', '2', '3', '4' ),
'1' => clienttranslate('Cloister Church'),
'2' => clienttranslate('Estate'),
/// ...
) );
Post Reply

Return to “Developers”