8000 bug #46239 [Translation] Refresh local translations on PushCommand if… · symfony/symfony@37b8077 · GitHub
[go: up one dir, main page]

Skip to content

Commit 37b8077

Browse files
committed
bug #46239 [Translation] Refresh local translations on PushCommand if the provider has domains (Florian-B)
This PR was merged into the 5.4 branch. Discussion ---------- [Translation] Refresh local translations on PushCommand if the provider has domains | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | no | License | MIT | Doc PR | no Since #45171 it's possible to define targeted translation domains in configuration. On `translation:push` without `--domains` option the command should read our configuration in order build local translations list. If the domain is only define in the configuration we need to refresh the local translations list to prevent full update of Provider (push all domains without filtering). I think we should add a test but I failed to do it properly. Commits ------- 8b0f7eb [Translation] Refresh local translations if the provider has domains
2 parents 0f95953 + 8b0f7eb commit 37b8077

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Symfony/Component/Translation/Command/TranslationPushCommand.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
131131
$force = $input->getOption('force');
132132
$deleteMissing = $input->getOption('delete-missing');
133133

134+
if (!$domains && $provider instanceof FilteringProvider) {
135+
$domains = $provider->getDomains();
136+
}
137+
138+
// Reading local translations must be done after retrieving the domains from the provider
139+
// in order to manage only translations from configured domains
134140
$localTranslations = $this->readLocalTranslations($locales, $domains, $this->transPaths);
135141

136142
if (!$domains) {
137-
if ($provider instanceof FilteringProvider) {
138-
$domains = $provider->getDomains();
139-
}
140-
141-
if (!$domains) {
142-
$domains = $this->getDomainsFromTranslatorBag($localTranslations);
143-
}
143+
$domains = $this->getDomainsFromTranslatorBag($localTranslations);
144144
}
145145

146146
if (!$deleteMissing && $force) {

0 commit comments

Comments
 (0)
0