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

Commit e9db551

Browse filesBrowse files
committed
feature #31242 Update LoggingTranslator to log the change of a locale (gmponos)
This PR was squashed before being merged into the 4.3-dev branch (closes #31242). Discussion ---------- Update LoggingTranslator to log the change of a locale | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT I would like to see inside my logs that the translator changed the locale. I've had a case that I spent significant amount of time trying to debug it. Commits ------- 20380f9 Update LoggingTranslator to log the change of a locale
2 parents 09e5cc1 + 20380f9 commit e9db551
Copy full SHA for e9db551

File tree

1 file changed

+2
-0
lines changed
Filter options

1 file changed

+2
-0
lines changed

‎src/Symfony/Component/Translation/LoggingTranslator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/LoggingTranslator.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ public function transChoice($id, $number, array $parameters = [], $domain = null
8282
*/
8383
public function setLocale($locale)
8484
{
85+
$prev = $this->translator->getLocale();
8586
$this->translator->setLocale($locale);
87+
$this->logger->debug(sprintf('The locale of the translator has changed from "%s" to "%s".', $prev, $locale));
8688
}
8789

8890
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.