Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorsgiehl <stefan@piwik.org>2015-07-04 22:40:13 +0300
committersgiehl <stefan@piwik.org>2015-09-25 21:07:47 +0300
commit417880459ca14234d3fe1e811bf622b12f1ab57b (patch)
tree41bf9d374c6349591afae4e72b35391be1983b5b /core
parent557c1b9bad6c7f7119dba49243eb641a9eb70778 (diff)
use new date/time formats; use updated internal names
Diffstat (limited to 'core')
-rw-r--r--core/Date.php15
-rw-r--r--core/Period/Day.php9
-rw-r--r--core/Period/Month.php4
-rw-r--r--core/Period/Range.php2
-rw-r--r--core/Period/Year.php2
-rw-r--r--core/Plugin/Visualization.php2
6 files changed, 23 insertions, 11 deletions
diff --git a/core/Date.php b/core/Date.php
index 4fac9d8595..44c34ea0ba 100644
--- a/core/Date.php
+++ b/core/Date.php
@@ -41,6 +41,16 @@ class Date
/** The default date time string format. */
const DATE_TIME_FORMAT = 'Y-m-d H:i:s';
+ const DATETIME_FORMAT_LONG = 'Intl_Format_DateTime_Long';
+ const DATETIME_FORMAT_SHORT = 'Intl_Format_DateTime_Short';
+ const DATE_FORMAT_LONG = 'Intl_Format_Date_Long';
+ const DATE_FORMAT_DAY_MONTH = 'Intl_Format_Date_Day_Month';
+ const DATE_FORMAT_SHORT = 'Intl_Format_Date_Short';
+ const DATE_FORMAT_MONTH_SHORT = 'Intl_Format_Month_Short';
+ const DATE_FORMAT_MONTH_LONG = 'Intl_Format_Month_Long';
+ const DATE_FORMAT_YEAR = 'Intl_Format_Year';
+ const TIME_FORMAT = 'Intl_Format_Time';
+
/**
* Max days for months (non-leap-year). See {@link addPeriod()} implementation.
*
@@ -612,6 +622,11 @@ class Date
{
$template = $this->replaceLegacyPlaceholders($template);
+ if (substr($template, 0, 5) == 'Intl_') {
+ $translator = StaticContainer::get('Piwik\Translation\Translator');
+ $template = $translator->translate($template);
+ }
+
$tokens = self::parseFormat($template);
$out = '';
diff --git a/core/Period/Day.php b/core/Period/Day.php
index 551e5e65aa..4933ddedf6 100644
--- a/core/Period/Day.php
+++ b/core/Period/Day.php
@@ -9,6 +9,7 @@
namespace Piwik\Period;
use Exception;
+use Piwik\Date;
use Piwik\Period;
use Piwik\Piwik;
@@ -38,9 +39,7 @@ class Day extends Period
{
//"Mon 15 Aug"
$date = $this->getDateStart();
- $template = $this->translator->translate('CoreHome_ShortDateFormat');
-
- $out = $date->getLocalized($template);
+ $out = $date->getLocalized(Date::DATE_FORMAT_DAY_MONTH);
return $out;
}
@@ -53,9 +52,7 @@ class Day extends Period
{
//"Mon 15 Aug"
$date = $this->getDateStart();
- $template = $this->translator->translate('CoreHome_DateFormat');
-
- $out = $date->getLocalized($template);
+ $out = $date->getLocalized(Date::DATE_FORMAT_LONG);
return $out;
}
diff --git a/core/Period/Month.php b/core/Period/Month.php
index 68d97e1d5f..4c779e4853 100644
--- a/core/Period/Month.php
+++ b/core/Period/Month.php
@@ -25,7 +25,7 @@ class Month extends Period
public function getLocalizedShortString()
{
//"Aug 09"
- $out = $this->getDateStart()->getLocalized($this->translator->translate('CoreHome_ShortMonthFormat'));
+ $out = $this->getDateStart()->getLocalized(Date::DATE_FORMAT_MONTH_SHORT);
return $out;
}
@@ -37,7 +37,7 @@ class Month extends Period
public function getLocalizedLongString()
{
//"August 2009"
- $out = $this->getDateStart()->getLocalized($this->translator->translate('CoreHome_LongMonthFormat'));
+ $out = $this->getDateStart()->getLocalized(Date::DATE_FORMAT_MONTH_LONG);
return $out;
}
diff --git a/core/Period/Range.php b/core/Period/Range.php
index 9e14565517..0bac3aad81 100644
--- a/core/Period/Range.php
+++ b/core/Period/Range.php
@@ -110,7 +110,7 @@ class Range extends Period
//"30 Dec 08 - 26 Feb 09"
$dateStart = $this->getDateStart();
$dateEnd = $this->getDateEnd();
- $template = $this->translator->translate('CoreHome_ShortDateFormatWithYear');
+ $template = Date::DATE_FORMAT_SHORT;
$shortDateStart = $dateStart->getLocalized($template);
$shortDateEnd = $dateEnd->getLocalized($template);
diff --git a/core/Period/Year.php b/core/Period/Year.php
index ccd9c2e2b3..cfda052bf5 100644
--- a/core/Period/Year.php
+++ b/core/Period/Year.php
@@ -35,7 +35,7 @@ class Year extends Period
public function getLocalizedLongString()
{
//"2009"
- $out = $this->getDateStart()->getLocalized("%longYear%");
+ $out = $this->getDateStart()->getLocalized(Date::DATE_FORMAT_YEAR);
return $out;
}
diff --git a/core/Plugin/Visualization.php b/core/Plugin/Visualization.php
index ceccc4ab13..b4ff042932 100644
--- a/core/Plugin/Visualization.php
+++ b/core/Plugin/Visualization.php
@@ -471,7 +471,7 @@ class Visualization extends ViewDataTable
return Piwik::translate('CoreHome_ReportGeneratedXAgo', $timeAgo);
}
- $prettyDate = $date->getLocalized("%longYear%, %longMonth% %day%") . $date->toString('S');
+ $prettyDate = $date->getLocalized(Date::DATE_FORMAT_SHORT);
return Piwik::translate('CoreHome_ReportGeneratedOn', $prettyDate);
}