本文整理汇总了PHP中Symfony\Component\Translation\MessageCatalogue::addMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP MessageCatalogue::addMessages方法的具体用法?PHP MessageCatalogue::addMessages怎么用?PHP MessageCatalogue::addMessages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Translation\MessageCatalogue
的用法示例。
在下文中一共展示了MessageCatalogue::addMessages方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAddMessages
public function testAddMessages()
{
$catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
$catalogue->addMessages(array('foo1' => 'foo1'), 'domain1');
$this->assertEquals('foo', $catalogue->getMessage('foo', 'domain1'));
$this->assertEquals('foo1', $catalogue->getMessage('foo1', 'domain1'));
$catalogue->addMessages(array('foo' => 'bar'), 'domain1');
$this->assertEquals('bar', $catalogue->getMessage('foo', 'domain1'));
$this->assertEquals('foo1', $catalogue->getMessage('foo1', 'domain1'));
$catalogue->addMessages(array('foo' => 'bar'), 'domain88');
$this->assertEquals('bar', $catalogue->getMessage('foo', 'domain88'));
}
示例2: load
/**
* {@inheritdoc}
*/
public function load($resource, $locale, $domain = 'messages')
{
$this->flatten($resource);
$catalogue = new MessageCatalogue($locale);
$catalogue->addMessages($resource, $domain);
return $catalogue;
}
示例3: load
/**
* {@inheritdoc}
*/
function load($resource, $locale, $domain = 'messages')
{
$catalogue = new MessageCatalogue($locale);
$catalogue->addMessages(require $resource, $domain);
$catalogue->addResource(new FileResource($resource));
return $catalogue;
}