diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-01-09 02:29:39 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-01-09 04:35:15 +0300 |
commit | 39c0ef2cf1a13a272271b5743561876ea41259d4 (patch) | |
tree | 82948f766790ca7b64f6e4e4ff99ca9344369bb0 /core/Date.php | |
parent | 60f3a652f77d0e0fcbcf6b4c1b7bebf781c1d948 (diff) |
Reduced the number of Container::get(), e.g. in Visitor Log (Live API) it suppressed 4000 calls, 100ms saved
Diffstat (limited to 'core/Date.php')
-rw-r--r-- | core/Date.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/Date.php b/core/Date.php index abc43c6971..26f07a7ac1 100644 --- a/core/Date.php +++ b/core/Date.php @@ -10,6 +10,7 @@ namespace Piwik; use Exception; +use Piwik\Container\StaticContainer; /** * Utility class that wraps date/time related PHP functions. Using this class can @@ -609,15 +610,16 @@ class Date */ public function getLocalized($template) { + $translator = StaticContainer::getContainer()->get('Piwik\Translation\Translator'); $day = $this->toString('j'); $dayOfWeek = $this->toString('N'); $monthOfYear = $this->toString('n'); $patternToValue = array( "%day%" => $day, - "%shortMonth%" => Piwik::translate('General_ShortMonth_' . $monthOfYear), - "%longMonth%" => Piwik::translate('General_LongMonth_' . $monthOfYear), - "%shortDay%" => Piwik::translate('General_ShortDay_' . $dayOfWeek), - "%longDay%" => Piwik::translate('General_LongDay_' . $dayOfWeek), + "%shortMonth%" => $translator->translate('General_ShortMonth_' . $monthOfYear), + "%longMonth%" => $translator->translate('General_LongMonth_' . $monthOfYear), + "%shortDay%" => $translator->translate('General_ShortDay_' . $dayOfWeek), + "%longDay%" => $translator->translate('General_LongDay_' . $dayOfWeek), "%longYear%" => $this->toString('Y'), "%shortYear%" => $this->toString('y'), "%time%" => $this->toString('H:i:s') |