[Translator] Preserve default domain when extracting strings from php files
This commit is contained in:
parent
2774705c39
commit
ca77d9a33e
@ -226,7 +226,10 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface
|
|||||||
} elseif (self::METHOD_ARGUMENTS_TOKEN === $item) {
|
} elseif (self::METHOD_ARGUMENTS_TOKEN === $item) {
|
||||||
$this->skipMethodArgument($tokenIterator);
|
$this->skipMethodArgument($tokenIterator);
|
||||||
} elseif (self::DOMAIN_TOKEN === $item) {
|
} elseif (self::DOMAIN_TOKEN === $item) {
|
||||||
$domain = $this->getValue($tokenIterator);
|
$domainToken = $this->getValue($tokenIterator);
|
||||||
|
if ('' !== $domainToken) {
|
||||||
|
$domain = $domainToken;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
@ -52,6 +52,7 @@ EOF;
|
|||||||
$expectedNowdoc => 'prefix'.$expectedNowdoc,
|
$expectedNowdoc => 'prefix'.$expectedNowdoc,
|
||||||
'{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples' => 'prefix{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples',
|
'{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples' => 'prefix{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples',
|
||||||
'concatenated message with heredoc and nowdoc' => 'prefixconcatenated message with heredoc and nowdoc',
|
'concatenated message with heredoc and nowdoc' => 'prefixconcatenated message with heredoc and nowdoc',
|
||||||
|
'default domain' => 'prefixdefault domain',
|
||||||
],
|
],
|
||||||
'not_messages' => [
|
'not_messages' => [
|
||||||
'other-domain-test-no-params-short-array' => 'prefixother-domain-test-no-params-short-array',
|
'other-domain-test-no-params-short-array' => 'prefixother-domain-test-no-params-short-array',
|
||||||
|
@ -55,3 +55,5 @@ EOF
|
|||||||
<?php echo $view['translator']->trans('typecast', ['a' => (int) '123'], 'not_messages'); ?>
|
<?php echo $view['translator']->trans('typecast', ['a' => (int) '123'], 'not_messages'); ?>
|
||||||
<?php echo $view['translator']->transChoice('msg1', 10 + 1, [], 'not_messages'); ?>
|
<?php echo $view['translator']->transChoice('msg1', 10 + 1, [], 'not_messages'); ?>
|
||||||
<?php echo $view['translator']->transChoice('msg2', ceil(4.5), [], 'not_messages'); ?>
|
<?php echo $view['translator']->transChoice('msg2', ceil(4.5), [], 'not_messages'); ?>
|
||||||
|
|
||||||
|
<?php echo $view['translator']->trans('default domain', [], null); ?>
|
||||||
|
Reference in New Issue
Block a user