Page 1 of 1

Internationalization of lists in notification logs

Posted: 08 January 2014, 10:54
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)

Re: Internationalization of lists in notification logs

Posted: 08 January 2014, 21:30
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'),
/// ...
) );