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

Skip to content

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

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 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5a53821
[OptionsResolver] fix removing normalizers
Tobion Jul 29, 2012
e2a50ef
[OptionsResolver] fix normalizer without corresponding option
Tobion Jul 30, 2012
5f62bad
[Translation] added validateCatalogueForId() to allow for handling of…
Apr 11, 2012
31c42bc
[FrameworkBundle] added logging capabilities to translator
Apr 11, 2012
efb36bb
[FrameworkBundle][Translation] renamed catalog select method
Sep 18, 2012
5e21921
[FrameworkBundle][Translation] clarified method naming
Sep 18, 2012
d1b5093
Try to make sure cookies get deleted from the TokenProvider when no l…
Nov 18, 2012
b930066
Add Route::hasOption() and Route::hasRequirement() methods.
Crell Nov 23, 2012
64b6980
merged branch Crell/route-requirements (PR #6098)
fabpot Nov 24, 2012
acec659
merged branch Tobion/patch-1 (PR #5104)
fabpot Nov 24, 2012
efe42cb
[Validator] Refactored the GraphWalker into an implementation of the …
webmozart Nov 22, 2012
1f752e8
[DoctrineBridge] Adapted UniqueValidator to latest changes in the Val…
webmozart Nov 22, 2012
1858b96
[Form] Adapted FormValidator to latest changes in the Validator
webmozart Nov 22, 2012
c8ebc1e
merged branch sli-systems/dc-1 (PR #6080)
fabpot Nov 24, 2012
d5ff238
merged branch TerjeBr/persistent-token-provider (PR #6055)
fabpot Nov 24, 2012
ee90986
merged branch bschussek/drupal-validator (PR #6096)
fabpot Nov 24, 2012
6966c7d
[Translation] added validateCatalogueForId() to allow for handling of…
Apr 11, 2012
a1716d0
[FrameworkBundle] added logging capabilities to translator
Apr 11, 2012
34309fd
[FrameworkBundle][Translation] renamed catalog select method
Sep 18, 2012
3716574
[FrameworkBundle][Translation] clarified method naming
Sep 18, 2012
0cf8d7d
Merge branch 'translator-log-catalog-misses' of github.com:meandmymon…
Nov 24, 2012
cc5e197
fixed merge conflict introduced by last commit
Nov 24, 2012
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
[FrameworkBundle][Translation] renamed catalog select method
  • Loading branch information
Andreas Hucks authored and Andreas Hucks committed Nov 24, 2012
commit 34309fd7eee5cc4e8ab2baf67dca85ac74e8ef34
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function setLogger(LoggerInterface $logger)
/**
* {@inheritdoc}
*/
protected function validateCatalogueForId(MessageCatalogueInterface $catalogue, $id, $domain)
protected function findCatalogueForId(MessageCatalogueInterface $catalogue, $id, $domain)
{
if (null !== $this->logger && !$catalogue->defines($id, $domain)) {
if ($catalogue->has($id, $domain)) {
Expand All @@ -94,7 +94,7 @@ protected function validateCatalogueForId(MessageCatalogueInterface $catalogue,
}
}

return parent::validateCatalogueForId($catalogue, $id, $domain);
return parent::findCatalogueForId($catalogue, $id, $domain);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Translation/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function trans($id, array $parameters = array(), $domain = 'messages', $l
$this->loadCatalogue($locale);
}

$catalogue = $this->validateCatalogueForId($this->catalogues[$locale], $id, $domain);
$catalogue = $this->findCatalogueForId($this->catalogues[$locale], $id, $domain);

return strtr($catalogue->get((string) $id, $domain), $parameters);
}
Expand All @@ -168,7 +168,7 @@ public function transChoice($id, $number, array $parameters = array(), $domain =

$id = (string) $id;

$catalogue = $this->validateCatalogueForId($this->catalogues[$locale], $id, $domain);
$catalogue = $this->findCatalogueForId($this->catalogues[$locale], $id, $domain);
while (!$catalogue->defines($id, $domain)) {
if ($cat = $catalogue->getFallbackCatalogue()) {
$catalogue = $cat;
Expand All @@ -189,7 +189,7 @@ public function transChoice($id, $number, array $parameters = array(), $domain =
* @param string $domain
* @return MessageCatalogueInterface
*/
protected function validateCatalogueForId(MessageCatalogueInterface $catalogue, $id, $domain)
protected function findCatalogueForId(MessageCatalogueInterface $catalogue, $id, $domain)
Copy link
Member

Choose a reason for hiding this comment

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

I still find the naming weird. This method does not find the catalogue as you are already finding it before that to pass it as an argument

Copy link
Author

Choose a reason for hiding this comment

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

What would you suggest?

Copy link
Author

Choose a reason for hiding this comment

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

And btw, it does return a catalogue to allow for further potential customization.

Copy link
Member

Choose a reason for hiding this comment

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

yes, it returns a catalogue. but it does not find it. All places using find as naming are actually finding the object. Here, you are eventually filtering the catalogue, but finding it is done before calling the method

Copy link
Author

Choose a reason for hiding this comment

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

Ok, filterCatalogueForId is fine.

{
// by default, do nothing
return $catalogue;
Expand Down
0