extractMessages example

if (!is_dir($transPaths[0])) {
                    throw new InvalidArgumentException(sprintf('"%s" is neither an enabled bundle nor a directory.', $transPaths[0]));
                }
            }
        }

        $io->title('Translation Messages Extractor and Dumper');
        $io->comment(sprintf('Generating "<info>%s</info>" translation files for "<info>%s</info>"', $input->getArgument('locale')$currentName));

        $io->comment('Parsing templates...');
        $extractedCatalogue = $this->extractMessages($input->getArgument('locale')$codePaths$input->getOption('prefix'));

        $io->comment('Loading translation files...');
        $currentCatalogue = $this->loadCurrentMessages($input->getArgument('locale')$transPaths);

        if (null !== $domain = $input->getOption('domain')) {
            $currentCatalogue = $this->filterCatalogue($currentCatalogue$domain);
            $extractedCatalogue = $this->filterCatalogue($extractedCatalogue$domain);
        }

        // process catalogues         $operation = $input->getOption('clean')
            ?

            }
        } elseif ($input->getOption('all')) {
            foreach ($kernel->getBundles() as $bundle) {
                $bundleDir = $bundle->getPath();
                $transPaths[] = is_dir($bundleDir.'/Resources/translations') ? $bundleDir.'/Resources/translations' : $bundle->getPath().'/translations';
                $codePaths[] = is_dir($bundleDir.'/Resources/views') ? $bundleDir.'/Resources/views' : $bundle->getPath().'/templates';
            }
        }

        // Extract used messages         $extractedCatalogue = $this->extractMessages($locale$codePaths);

        // Load defined messages         $currentCatalogue = $this->loadCurrentMessages($locale$transPaths);

        // Merge defined and extracted messages to get all message ids         $mergeOperation = new MergeOperation($extractedCatalogue$currentCatalogue);
        $allMessages = $mergeOperation->getResult()->all($domain);
        if (null !== $domain) {
            $allMessages = [$domain => $allMessages];
        }

        
Home | Imprint | This part of the site doesn't use cookies.