-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Translation] added LoggingTranslator. #10887
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
Changes from 1 commit
a532d24
c319cef
f543258
8fdd235
0f2294d
ecea954
38fb884
071880b
8af5171
c7ee300
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,12 +28,12 @@ class LoggableTranslator implements TranslatorInterface | |
*/ | ||
private $logger; | ||
|
||
/** | ||
* @param Translator $translator The translator | ||
* @param LoggerInterface $logger A logger instance | ||
*/ | ||
public function __construct(Translator $translator, LoggerInterface $logger) | ||
public function __construct($translator, LoggerInterface $logger) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing phpdoc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Tobion $translator must implements TranslatorInterface and TranslatorBagInterface and I don't find the standard way to document it ?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks good to me |
||
{ | ||
if (!($translator instanceof TranslatorInterface && $translator instanceof TranslatorBagInterface)) { | ||
throw new \InvalidArgumentException(sprintf('The Translator "%s" must implements TranslatorInterface and TranslatorBagInterface.', get_class($translator))); | ||
} | ||
|
||
$this->translator = $translator; | ||
$this->logger = $logger; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Translation; | ||
|
||
/** | ||
* TranslatorBagInterface | ||
* | ||
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com> | ||
*/ | ||
interface TranslatorBagInterface | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need this interface. There was also none added for #9859 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agreed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. then just typehint in the constructor the concrete implmentation instead of the interface. until we can add these methods in the interface in 3.0 |
||
{ | ||
/** | ||
* Gets the catalogue by locale. | ||
* | ||
* @param string|null $locale The locale or null to use the default | ||
* | ||
* @return MessageCatalogueInterface | ||
*/ | ||
public function getCatalogue($locale = null); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's going to be for 2.6.