8000 [2.2] [FrameworkBundle][Translation] Added logging capability to translator by meandmymonkey · Pull Request #3890 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[2.2] [FrameworkBundle][Translation] Added logging capability to translator #3890

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 3 commits into from
Closed

[2.2] [FrameworkBundle][Translation] Added logging capability to translator #3890

wants to merge 3 commits into from

Conversation

meandmymonkey
Copy link

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #3015
Todo: -

Adds logging capabilities to Symfony\Bundle\FrameworkBundle\Translation\Translator. Logging is switchable through the new logging config flag and defaults to false.

A minor addition to the Translation Component was necessary to avoid complete duplication of trans()and transChoice().

@@ -337,6 +337,7 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode)
->treatTrueLike(array('enabled' => true))
->children()
->booleanNode('enabled')->defaultTrue()->end()
->booleanNode('enable_logging')->defaultFalse()->end()
Copy link
Member

Choose a reason for hiding this comment

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

it should simply be named logging to be consistent with DoctrineBundle

Copy link
Author

Choose a reason for hiding this comment

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

fast as always :)

done.

@ghost
Copy link
ghost commented Sep 9, 2012

Subscribing...

This feature would be useful right now... Sad it's not merged yet.

{
if (null !== $this->logger && !$catalogue->defines($id, $domain)) {
if ($catalogue->has($id, $domain)) {
$this->logger->notice('Translator: using fallback catalogue.', array('id' => $id, 'domain' => $domain));
Copy link

Choose a reason for hiding this comment

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

@meandmymonkey Thanks for making this PR. I know that a lot of time passed but could you also pass locale ($this->getLocale()) to the logger?

@stof
Copy link
Member
stof commented Sep 9, 2012

This needs some tests

@meandmymonkey
Copy link
Author

Github seems to have lost the reference to the commits in my repo, probably because I messed with my fork since the commits in April. I' closing this and re-opening here: #5537

Method ist renamed, tests will follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0