$this->
assertSame('Hello Bob',
$translator->
trans('some_message',
['%name%' => 'Bob'
]));
$translator->
addResource('array',
['some_message' => 'Hi {name}'
], 'en', 'messages+intl-icu'
);
$this->
assertSame('Hi Bob',
$translator->
trans('some_message',
['%name%' => 'Bob'
]));
} public function testIntlDomainOverlapseWithIntlResourceBefore() { $intlFormatterMock =
$this->
createMock(IntlFormatterInterface::
class);
$intlFormatterMock->
expects($this->
once())->
method('formatIntl'
)->
with('hello intl', 'en',
[])->
willReturn('hello intl'
);
$messageFormatter =
new MessageFormatter(null,
$intlFormatterMock);
$translator =
new Translator('en',
$messageFormatter);
$translator->
addLoader('array',
new ArrayLoader());
$translator->
addResource('array',
['some_message' => 'hello intl'
], 'en', 'messages+intl-icu'
);
$translator->
addResource('array',
['some_message' => 'hello'
], 'en', 'messages'
);
$this->
assertSame('hello',
$translator->
trans('some_message',
[], 'messages'
));
$translator->
addResource('array',
['some_message' => 'hello intl'
], 'en', 'messages+intl-icu'
);