Skip to content

Commit e970476

Browse files
committed
look for translation files with intl domain suffix, too
1 parent 7ace69c commit e970476

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/FileStorage.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,16 @@ private function writeCatalogue(MessageCatalogueInterface $catalogue, string $lo
140140
$resources = $catalogue->getResources();
141141
$options = $this->options;
142142
$written = false;
143+
$intlDomainSuffix = '(\\' . MessageCatalogueInterface::INTL_DOMAIN_SUFFIX . ')';
144+
$searchPatternWithIntl = '|/'.$domain . $intlDomainSuffix . '\.'.$locale.'\.([a-z]+)$|';
145+
$searchPatternWithoutIntl = str_replace($intlDomainSuffix, '', $searchPatternWithIntl);
143146
foreach ($resources as $resource) {
144147
$path = (string) $resource;
145-
if (preg_match('|/'.$domain.'\.'.$locale.'\.([a-z]+)$|', $path, $matches)) {
148+
if (preg_match($searchPatternWithIntl, $path, $matches)) {
149+
$options['path'] = str_replace($matches[0], '', $path);
150+
$this->writer->write($catalogue, $matches[2], $options);
151+
$written = true;
152+
} elseif (preg_match($searchPatternWithoutIntl, $path, $matches)) {
146153
$options['path'] = str_replace($matches[0], '', $path);
147154
$this->writer->write($catalogue, $matches[1], $options);
148155
$written = true;

0 commit comments

Comments
 (0)