Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Translation] added extract messages from controllers #26738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Translation] added extract messages from controllers
  • Loading branch information
Thomas Agé committed May 1, 2018
commit 83b7a94fc8f04fe1f668aabe9e12edcce9c89009
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ class TranslationUpdateCommand extends Command
private $defaultLocale;
private $defaultTransPath;
private $defaultViewsPath;
private $defaultControllersPath;

public function __construct(TranslationWriterInterface $writer, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultLocale, string $defaultTransPath = null, string $defaultViewsPath = null)
public function __construct(TranslationWriterInterface $writer, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultLocale, string $defaultTransPath = null, string $defaultViewsPath = null, string $defaultControllersPath = null)
{
parent::__construct();

Expand All @@ -54,6 +55,7 @@ public function __construct(TranslationWriterInterface $writer, TranslationReade
$this->defaultLocale = $defaultLocale;
$this->defaultTransPath = $defaultTransPath;
$this->defaultViewsPath = $defaultViewsPath;
$this->defaultControllersPath = $defaultControllersPath;
}

/**
Expand Down Expand Up @@ -128,6 +130,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
$viewsPaths[] = $this->defaultViewsPath;
}
$controllersPaths = array($kernel->getRootDir().'/Controller');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if my controllers are somewhere else?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iltar you're right. I added a parameter to constructor (as for the views). But I'm not sure how to test it. Can you help me?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about making the parameter an array of paths? That would cover multiple locations. You can test it by writing fixtures for your test, writing controllers with translations.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An array of paths sounds great to me, but for the tests I wonder how to set path(s) when I call the command on CLI (bin/console translation:update)?

When I try your suggestion, it returns null for $this->router.
I'm not sure it's OK to have a behaviour for templates (parameter in constructor) and another behaviour for controllers (find auto).

if ($this->defaultControllersPath) {
$controllersPaths[] = $this->defaultControllersPath;
}
$currentName = 'app folder';

// Override with provided Bundle info
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.