[translation] Fix update existing key with existing +int-icu domain
This commit is contained in:
parent
9a8e2c2625
commit
2a196ca0dc
@ -167,7 +167,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf
|
|||||||
}
|
}
|
||||||
$intlDomain = $domain;
|
$intlDomain = $domain;
|
||||||
$suffixLength = \strlen(self::INTL_DOMAIN_SUFFIX);
|
$suffixLength = \strlen(self::INTL_DOMAIN_SUFFIX);
|
||||||
if (\strlen($domain) > $suffixLength && false !== strpos($domain, self::INTL_DOMAIN_SUFFIX, -$suffixLength)) {
|
if (\strlen($domain) < $suffixLength || false === strpos($domain, self::INTL_DOMAIN_SUFFIX, -$suffixLength)) {
|
||||||
$intlDomain .= self::INTL_DOMAIN_SUFFIX;
|
$intlDomain .= self::INTL_DOMAIN_SUFFIX;
|
||||||
}
|
}
|
||||||
foreach ($messages as $id => $message) {
|
foreach ($messages as $id => $message) {
|
||||||
|
@ -69,7 +69,7 @@ class MessageCatalogueTest extends TestCase
|
|||||||
$this->assertEquals($messages, $catalogue->all());
|
$this->assertEquals($messages, $catalogue->all());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAllIntICU()
|
public function testAllIntlIcu()
|
||||||
{
|
{
|
||||||
$messages = [
|
$messages = [
|
||||||
'domain1+intl-icu' => ['foo' => 'bar'],
|
'domain1+intl-icu' => ['foo' => 'bar'],
|
||||||
@ -129,6 +129,16 @@ class MessageCatalogueTest extends TestCase
|
|||||||
$this->assertEquals('bar', $catalogue->get('foo', 'domain88'));
|
$this->assertEquals('bar', $catalogue->get('foo', 'domain88'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAddIntlIcu()
|
||||||
|
{
|
||||||
|
$catalogue = new MessageCatalogue('en', ['domain1+intl-icu' => ['foo' => 'foo']]);
|
||||||
|
$catalogue->add(['foo1' => 'foo1'], 'domain1');
|
||||||
|
$catalogue->add(['foo' => 'bar'], 'domain1');
|
||||||
|
|
||||||
|
$this->assertSame('bar', $catalogue->get('foo', 'domain1'));
|
||||||
|
$this->assertSame('foo1', $catalogue->get('foo1', 'domain1'));
|
||||||
|
}
|
||||||
|
|
||||||
public function testReplace()
|
public function testReplace()
|
||||||
{
|
{
|
||||||
$catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain1+intl-icu' => ['bar' => 'bar']]);
|
$catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain1+intl-icu' => ['bar' => 'bar']]);
|
||||||
|
Reference in New Issue
Block a user