diff --git a/core/Date.php b/core/Date.php index 4fac9d8595d561f605ab47a21a7146a83be27c80..44c34ea0ba4733ae238de838b676a4b0bfe6c58d 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 551e5e65aa4df316827f361bc00bcfe1eac53df5..4933ddedf6c78b75d694b31f12922794fcb5c537 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 68d97e1d5faff0b67caa2d71060739966aed7e97..4c779e48537b9c7bfa2a33ac19afab995eba7bbd 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 9e14565517b26e883c74f297793ca1722c61e261..0bac3aad819af3ca1f7246dfb1f0cf08cdf5aeeb 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 ccd9c2e2b3ba6960b010478d7cdf2750010226d2..cfda052bf575c98a8a7cc9f06052fa272a6e0154 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 ceccc4ab13579fb0741ade46b835fb370428efcf..b4ff04293251b4ef5868cd6a1e452c671d872a37 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); } diff --git a/plugins/Annotations/Controller.php b/plugins/Annotations/Controller.php index 9a777050f150adf4143c93e62aeaea2d319ec1c7..2572864a806fb06693ea577637fc17390a455191 100755 --- a/plugins/Annotations/Controller.php +++ b/plugins/Annotations/Controller.php @@ -78,7 +78,7 @@ class Controller extends \Piwik\Plugin\Controller $view->selectedDate = $endDate->toString(); } - $dateFormat = Piwik::translate('CoreHome_ShortDateFormatWithYear'); + $dateFormat = Date::DATE_FORMAT_SHORT; $view->startDatePretty = $startDate->getLocalized($dateFormat); $view->endDatePretty = $endDate->getLocalized($dateFormat); diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php index 45a3dde104b5323ff886abc060b1c41b60be0451..23da8326aad66027a02ef34298694ebc8282552d 100644 --- a/plugins/CoreHome/CoreHome.php +++ b/plugins/CoreHome/CoreHome.php @@ -171,7 +171,7 @@ class CoreHome extends \Piwik\Plugin $translationKeys[] = 'General_Loading'; $translationKeys[] = 'General_Show'; $translationKeys[] = 'General_Hide'; - $translationKeys[] = 'Intl_YearShort'; + $translationKeys[] = 'Intl_Year_Short'; $translationKeys[] = 'General_MultiSitesSummary'; $translationKeys[] = 'CoreHome_YouAreUsingTheLatestVersion'; $translationKeys[] = 'CoreHome_IncludeRowsWithLowPopulation'; @@ -193,51 +193,51 @@ class CoreHome extends \Piwik\Plugin $translationKeys[] = 'Annotations_HideAnnotationsFor'; $translationKeys[] = 'General_LoadingPopover'; $translationKeys[] = 'General_LoadingPopoverFor'; - $translationKeys[] = 'Intl_ShortMonth_1'; - $translationKeys[] = 'Intl_ShortMonth_2'; - $translationKeys[] = 'Intl_ShortMonth_3'; - $translationKeys[] = 'Intl_ShortMonth_4'; - $translationKeys[] = 'Intl_ShortMonth_5'; - $translationKeys[] = 'Intl_ShortMonth_6'; - $translationKeys[] = 'Intl_ShortMonth_7'; - $translationKeys[] = 'Intl_ShortMonth_8'; - $translationKeys[] = 'Intl_ShortMonth_9'; - $translationKeys[] = 'Intl_ShortMonth_10'; - $translationKeys[] = 'Intl_ShortMonth_11'; - $translationKeys[] = 'Intl_ShortMonth_12'; - $translationKeys[] = 'Intl_LongMonth_1'; - $translationKeys[] = 'Intl_LongMonth_2'; - $translationKeys[] = 'Intl_LongMonth_3'; - $translationKeys[] = 'Intl_LongMonth_4'; - $translationKeys[] = 'Intl_LongMonth_5'; - $translationKeys[] = 'Intl_LongMonth_6'; - $translationKeys[] = 'Intl_LongMonth_7'; - $translationKeys[] = 'Intl_LongMonth_8'; - $translationKeys[] = 'Intl_LongMonth_9'; - $translationKeys[] = 'Intl_LongMonth_10'; - $translationKeys[] = 'Intl_LongMonth_11'; - $translationKeys[] = 'Intl_LongMonth_12'; - $translationKeys[] = 'Intl_ShortDay_1'; - $translationKeys[] = 'Intl_ShortDay_2'; - $translationKeys[] = 'Intl_ShortDay_3'; - $translationKeys[] = 'Intl_ShortDay_4'; - $translationKeys[] = 'Intl_ShortDay_5'; - $translationKeys[] = 'Intl_ShortDay_6'; - $translationKeys[] = 'Intl_ShortDay_7'; - $translationKeys[] = 'Intl_LongDay_1'; - $translationKeys[] = 'Intl_LongDay_2'; - $translationKeys[] = 'Intl_LongDay_3'; - $translationKeys[] = 'Intl_LongDay_4'; - $translationKeys[] = 'Intl_LongDay_5'; - $translationKeys[] = 'Intl_LongDay_6'; - $translationKeys[] = 'Intl_LongDay_7'; - $translationKeys[] = 'Intl_DayMo'; - $translationKeys[] = 'Intl_DayTu'; - $translationKeys[] = 'Intl_DayWe'; - $translationKeys[] = 'Intl_DayTh'; - $translationKeys[] = 'Intl_DayFr'; - $translationKeys[] = 'Intl_DaySa'; - $translationKeys[] = 'Intl_DaySu'; + $translationKeys[] = 'Intl_Month_Short_StandAlone_1'; + $translationKeys[] = 'Intl_Month_Short_StandAlone_2'; + $translationKeys[] = 'Intl_Month_Short_StandAlone_3'; + $translationKeys[] = 'Intl_Month_Short_StandAlone_4'; + $translationKeys[] = 'Intl_Month_Short_StandAlone_5'; + $translationKeys[] = 'Intl_Month_Short_StandAlone_6'; + $translationKeys[] = 'Intl_Month_Short_StandAlone_7'; + $translationKeys[] = 'Intl_Month_Short_StandAlone_8'; + $translationKeys[] = 'Intl_Month_Short_StandAlone_9'; + $translationKeys[] = 'Intl_Month_Short_StandAlone_10'; + $translationKeys[] = 'Intl_Month_Short_StandAlone_11'; + $translationKeys[] = 'Intl_Month_Short_StandAlone_12'; + $translationKeys[] = 'Intl_Month_Long_StandAlone_1'; + $translationKeys[] = 'Intl_Month_Long_StandAlone_2'; + $translationKeys[] = 'Intl_Month_Long_StandAlone_3'; + $translationKeys[] = 'Intl_Month_Long_StandAlone_4'; + $translationKeys[] = 'Intl_Month_Long_StandAlone_5'; + $translationKeys[] = 'Intl_Month_Long_StandAlone_6'; + $translationKeys[] = 'Intl_Month_Long_StandAlone_7'; + $translationKeys[] = 'Intl_Month_Long_StandAlone_8'; + $translationKeys[] = 'Intl_Month_Long_StandAlone_9'; + $translationKeys[] = 'Intl_Month_Long_StandAlone_10'; + $translationKeys[] = 'Intl_Month_Long_StandAlone_11'; + $translationKeys[] = 'Intl_Month_Long_StandAlone_12'; + $translationKeys[] = 'Intl_Day_Short_StandAlone_1'; + $translationKeys[] = 'Intl_Day_Short_StandAlone_2'; + $translationKeys[] = 'Intl_Day_Short_StandAlone_3'; + $translationKeys[] = 'Intl_Day_Short_StandAlone_4'; + $translationKeys[] = 'Intl_Day_Short_StandAlone_5'; + $translationKeys[] = 'Intl_Day_Short_StandAlone_6'; + $translationKeys[] = 'Intl_Day_Short_StandAlone_7'; + $translationKeys[] = 'Intl_Day_Long_StandAlone_1'; + $translationKeys[] = 'Intl_Day_Long_StandAlone_2'; + $translationKeys[] = 'Intl_Day_Long_StandAlone_3'; + $translationKeys[] = 'Intl_Day_Long_StandAlone_4'; + $translationKeys[] = 'Intl_Day_Long_StandAlone_5'; + $translationKeys[] = 'Intl_Day_Long_StandAlone_6'; + $translationKeys[] = 'Intl_Day_Long_StandAlone_7'; + $translationKeys[] = 'Intl_Day_Min_StandAlone_1'; + $translationKeys[] = 'Intl_Day_Min_StandAlone_2'; + $translationKeys[] = 'Intl_Day_Min_StandAlone_3'; + $translationKeys[] = 'Intl_Day_Min_StandAlone_4'; + $translationKeys[] = 'Intl_Day_Min_StandAlone_5'; + $translationKeys[] = 'Intl_Day_Min_StandAlone_6'; + $translationKeys[] = 'Intl_Day_Min_StandAlone_7'; $translationKeys[] = 'General_Search'; $translationKeys[] = 'General_Clear'; $translationKeys[] = 'General_MoreDetails'; diff --git a/plugins/CoreHome/javascripts/calendar.js b/plugins/CoreHome/javascripts/calendar.js index cf707810552ee5e008d7f9ce03fbbb2b92ffb0fd..1c308fb74c3492ff9eba7f059df3994ac8a5c68b 100644 --- a/plugins/CoreHome/javascripts/calendar.js +++ b/plugins/CoreHome/javascripts/calendar.js @@ -131,55 +131,55 @@ stepMonths: 1, // jquery-ui-i18n 1.7.2 lacks some translations, so we use our own dayNamesMin: [ - _pk_translate('Intl_DaySu'), - _pk_translate('Intl_DayMo'), - _pk_translate('Intl_DayTu'), - _pk_translate('Intl_DayWe'), - _pk_translate('Intl_DayTh'), - _pk_translate('Intl_DayFr'), - _pk_translate('Intl_DaySa')], + _pk_translate('Intl_Day_Min_StandAlone_7'), + _pk_translate('Intl_Day_Min_StandAlone_1'), + _pk_translate('Intl_Day_Min_StandAlone_2'), + _pk_translate('Intl_Day_Min_StandAlone_3'), + _pk_translate('Intl_Day_Min_StandAlone_4'), + _pk_translate('Intl_Day_Min_StandAlone_5'), + _pk_translate('Intl_Day_Min_StandAlone_6')], dayNamesShort: [ - _pk_translate('Intl_ShortDay_7'), // start with sunday - _pk_translate('Intl_ShortDay_1'), - _pk_translate('Intl_ShortDay_2'), - _pk_translate('Intl_ShortDay_3'), - _pk_translate('Intl_ShortDay_4'), - _pk_translate('Intl_ShortDay_5'), - _pk_translate('Intl_ShortDay_6')], + _pk_translate('Intl_Day_Short_StandAlone_7'), // start with sunday + _pk_translate('Intl_Day_Short_StandAlone_1'), + _pk_translate('Intl_Day_Short_StandAlone_2'), + _pk_translate('Intl_Day_Short_StandAlone_3'), + _pk_translate('Intl_Day_Short_StandAlone_4'), + _pk_translate('Intl_Day_Short_StandAlone_5'), + _pk_translate('Intl_Day_Short_StandAlone_6')], dayNames: [ - _pk_translate('Intl_LongDay_7'), // start with sunday - _pk_translate('Intl_LongDay_1'), - _pk_translate('Intl_LongDay_2'), - _pk_translate('Intl_LongDay_3'), - _pk_translate('Intl_LongDay_4'), - _pk_translate('Intl_LongDay_5'), - _pk_translate('Intl_LongDay_6')], + _pk_translate('Intl_Day_Long_StandAlone_7'), // start with sunday + _pk_translate('Intl_Day_Long_StandAlone_1'), + _pk_translate('Intl_Day_Long_StandAlone_2'), + _pk_translate('Intl_Day_Long_StandAlone_3'), + _pk_translate('Intl_Day_Long_StandAlone_4'), + _pk_translate('Intl_Day_Long_StandAlone_5'), + _pk_translate('Intl_Day_Long_StandAlone_6')], monthNamesShort: [ - _pk_translate('Intl_ShortMonth_1'), - _pk_translate('Intl_ShortMonth_2'), - _pk_translate('Intl_ShortMonth_3'), - _pk_translate('Intl_ShortMonth_4'), - _pk_translate('Intl_ShortMonth_5'), - _pk_translate('Intl_ShortMonth_6'), - _pk_translate('Intl_ShortMonth_7'), - _pk_translate('Intl_ShortMonth_8'), - _pk_translate('Intl_ShortMonth_9'), - _pk_translate('Intl_ShortMonth_10'), - _pk_translate('Intl_ShortMonth_11'), - _pk_translate('Intl_ShortMonth_12')], + _pk_translate('Intl_Month_Short_StandAlone_1'), + _pk_translate('Intl_Month_Short_StandAlone_2'), + _pk_translate('Intl_Month_Short_StandAlone_3'), + _pk_translate('Intl_Month_Short_StandAlone_4'), + _pk_translate('Intl_Month_Short_StandAlone_5'), + _pk_translate('Intl_Month_Short_StandAlone_6'), + _pk_translate('Intl_Month_Short_StandAlone_7'), + _pk_translate('Intl_Month_Short_StandAlone_8'), + _pk_translate('Intl_Month_Short_StandAlone_9'), + _pk_translate('Intl_Month_Short_StandAlone_10'), + _pk_translate('Intl_Month_Short_StandAlone_11'), + _pk_translate('Intl_Month_Short_StandAlone_12')], monthNames: [ - _pk_translate('Intl_LongMonth_1'), - _pk_translate('Intl_LongMonth_2'), - _pk_translate('Intl_LongMonth_3'), - _pk_translate('Intl_LongMonth_4'), - _pk_translate('Intl_LongMonth_5'), - _pk_translate('Intl_LongMonth_6'), - _pk_translate('Intl_LongMonth_7'), - _pk_translate('Intl_LongMonth_8'), - _pk_translate('Intl_LongMonth_9'), - _pk_translate('Intl_LongMonth_10'), - _pk_translate('Intl_LongMonth_11'), - _pk_translate('Intl_LongMonth_12')] + _pk_translate('Intl_Month_Long_StandAlone_1'), + _pk_translate('Intl_Month_Long_StandAlone_2'), + _pk_translate('Intl_Month_Long_StandAlone_3'), + _pk_translate('Intl_Month_Long_StandAlone_4'), + _pk_translate('Intl_Month_Long_StandAlone_5'), + _pk_translate('Intl_Month_Long_StandAlone_6'), + _pk_translate('Intl_Month_Long_StandAlone_7'), + _pk_translate('Intl_Month_Long_StandAlone_8'), + _pk_translate('Intl_Month_Long_StandAlone_9'), + _pk_translate('Intl_Month_Long_StandAlone_10'), + _pk_translate('Intl_Month_Long_StandAlone_11'), + _pk_translate('Intl_Month_Long_StandAlone_12')] }; }; diff --git a/plugins/CoreHome/javascripts/donate.js b/plugins/CoreHome/javascripts/donate.js index a1f78a38f91e4f8761171829132c7cc45d331d2f..e403f184978776d38685755a5c8603cebcfe1b47 100755 --- a/plugins/CoreHome/javascripts/donate.js +++ b/plugins/CoreHome/javascripts/donate.js @@ -24,7 +24,7 @@ // set's the correct amount text & smiley face image based on the position of the slider var setSmileyFaceAndAmount = function (slider, pos) { // set text yearly amount - $('.slider-donate-amount', slider).text('$' + donateAmounts[pos] + '/' + _pk_translate('Intl_YearShort')); + $('.slider-donate-amount', slider).text('$' + donateAmounts[pos] + '/' + _pk_translate('Intl_Year_Short')); // set the right smiley face $('.slider-smiley-face').attr('src', 'plugins/Morpheus/images/smileyprog_' + pos + '.png'); diff --git a/plugins/CoreHome/templates/_donate.twig b/plugins/CoreHome/templates/_donate.twig index 34cd2065750e75d509aac6e65422450549089327..cfee8557b8ec71140f7fe8c812b1b2e7895006e8 100755 --- a/plugins/CoreHome/templates/_donate.twig +++ b/plugins/CoreHome/templates/_donate.twig @@ -24,7 +24,7 @@ <div class="slider-position"></div> </div> <div style="display:inline-block;"> - <div class="slider-donate-amount">$30/{{ 'Intl_YearShort'|translate }}</div> + <div class="slider-donate-amount">$30/{{ 'Intl_Year_Short'|translate }}</div> <img class="slider-smiley-face" width="40" height="40" src="plugins/Morpheus/images/smileyprog_1.png"/> </div> diff --git a/plugins/CorePluginsAdmin/Marketplace.php b/plugins/CorePluginsAdmin/Marketplace.php index b413ddf13bc38aa4db109aa68f52caa274b2888d..c4835856b02305eb2f88778eedd8753a9748d172 100644 --- a/plugins/CorePluginsAdmin/Marketplace.php +++ b/plugins/CorePluginsAdmin/Marketplace.php @@ -141,11 +141,9 @@ class Marketplace private function enrichPluginInformation($plugin) { - $dateFormat = Piwik::translate('CoreHome_ShortDateFormatWithYear'); - $plugin['isInstalled'] = \Piwik\Plugin\Manager::getInstance()->isPluginLoaded($plugin['name']); $plugin['canBeUpdated'] = $plugin['isInstalled'] && $this->hasPluginUpdate($plugin); - $plugin['lastUpdated'] = Date::factory($plugin['lastUpdated'])->getLocalized($dateFormat); + $plugin['lastUpdated'] = Date::factory($plugin['lastUpdated'])->getLocalized(Date::DATE_FORMAT_SHORT); if ($plugin['canBeUpdated']) { $pluginUpdate = $this->getPluginUpdateInformation($plugin); @@ -156,18 +154,15 @@ class Marketplace if (!empty($plugin['activity']['lastCommitDate']) && false === strpos($plugin['activity']['lastCommitDate'], '0000')) { - $dateFormat = Piwik::translate('CoreHome_DateFormat'); - $plugin['activity']['lastCommitDate'] = Date::factory($plugin['activity']['lastCommitDate'])->getLocalized($dateFormat); + $plugin['activity']['lastCommitDate'] = Date::factory($plugin['activity']['lastCommitDate'])->getLocalized(Date::DATE_FORMAT_LONG); } else { $plugin['activity']['lastCommitDate'] = null; } if (!empty($plugin['versions'])) { - $dateFormat = Piwik::translate('CoreHome_DateFormat'); - foreach ($plugin['versions'] as $index => $version) { - $plugin['versions'][$index]['release'] = Date::factory($version['release'])->getLocalized($dateFormat); + $plugin['versions'][$index]['release'] = Date::factory($version['release'])->getLocalized(Date::DATE_FORMAT_LONG); } } diff --git a/plugins/DBStats/Tasks.php b/plugins/DBStats/Tasks.php index 149cca82bb9a0f24a8e6c8382f2bed90c07b7081..0d777760e5d1e3a9181cda4223ea00970c91b7d2 100644 --- a/plugins/DBStats/Tasks.php +++ b/plugins/DBStats/Tasks.php @@ -28,7 +28,7 @@ class Tasks extends \Piwik\Plugin\Tasks $api->getIndividualReportsSummary(true); $api->getIndividualMetricsSummary(true); - $now = Date::now()->getLocalized("%longYear%, %shortMonth% %day%"); + $now = Date::now()->getLocalized(Date::DATE_FORMAT_SHORT); Option::set(DBStats::TIME_OF_LAST_TASK_RUN_OPTION, $now); } } \ No newline at end of file diff --git a/plugins/Live/API.php b/plugins/Live/API.php index 63ef0bbbd298b1e801638b7fe5a1bd212b3d9708..9d02eac3ee25c5573eba4a38c9b8b61ae95e5912 100644 --- a/plugins/Live/API.php +++ b/plugins/Live/API.php @@ -317,13 +317,13 @@ class API extends \Piwik\Plugin\API $dateTimeVisit = Date::factory($visitorDetailsArray['lastActionTimestamp'], $timezone); if ($dateTimeVisit) { - $visitorDetailsArray['serverTimePretty'] = $dateTimeVisit->getLocalized('%time%'); - $visitorDetailsArray['serverDatePretty'] = $dateTimeVisit->getLocalized(Piwik::translate('CoreHome_DateFormat')); + $visitorDetailsArray['serverTimePretty'] = $dateTimeVisit->getLocalized(Date::TIME_FORMAT); + $visitorDetailsArray['serverDatePretty'] = $dateTimeVisit->getLocalized(Date::DATE_FORMAT_LONG); } $dateTimeVisitFirstAction = Date::factory($visitorDetailsArray['firstActionTimestamp'], $timezone); - $visitorDetailsArray['serverDatePrettyFirstAction'] = $dateTimeVisitFirstAction->getLocalized(Piwik::translate('CoreHome_DateFormat')); - $visitorDetailsArray['serverTimePrettyFirstAction'] = $dateTimeVisitFirstAction->getLocalized('%time%'); + $visitorDetailsArray['serverDatePrettyFirstAction'] = $dateTimeVisitFirstAction->getLocalized(Date::DATE_FORMAT_LONG); + $visitorDetailsArray['serverTimePrettyFirstAction'] = $dateTimeVisitFirstAction->getLocalized(Date::TIME_FORMAT); $visitorDetailsArray['actionDetails'] = array(); if (!$doNotFetchActions) { diff --git a/plugins/Live/Visitor.php b/plugins/Live/Visitor.php index 341ac590c9d2fbbc12df4eb2f3847d84a4a124da..a330f3ea3a846b91aea631825c1cdc4845a27ce8 100644 --- a/plugins/Live/Visitor.php +++ b/plugins/Live/Visitor.php @@ -426,7 +426,7 @@ class Visitor implements VisitorInterface // Convert datetimes to the site timezone $dateTimeVisit = Date::factory($details['serverTimePretty'], $timezone); - $details['serverTimePretty'] = $dateTimeVisit->getLocalized(Piwik::translate('CoreHome_ShortDateFormat') . ' %time%'); + $details['serverTimePretty'] = $dateTimeVisit->getLocalized(Date::DATETIME_FORMAT_SHORT); $details['timestamp'] = $dateTimeVisit->getTimestamp(); } diff --git a/plugins/Live/VisitorProfile.php b/plugins/Live/VisitorProfile.php index 36ab1bce7248f7f3a7e0d45115a0e11c77ea8ef8..58201a3f9ff42fdef27e9dccb4f81ab277a2f0ec 100644 --- a/plugins/Live/VisitorProfile.php +++ b/plugins/Live/VisitorProfile.php @@ -97,7 +97,7 @@ class VisitorProfile $serverDate = $visit->getColumn('firstActionTimestamp'); return array( 'date' => $serverDate, - 'prettyDate' => Date::factory($serverDate)->getLocalized(Piwik::translate('CoreHome_DateFormat')), + 'prettyDate' => Date::factory($serverDate)->getLocalized(Date::DATE_FORMAT_LONG), 'daysAgo' => (int)Date::secondsToDays($today->getTimestamp() - Date::factory($serverDate)->getTimestamp()), 'referrerType' => $visit->getColumn('referrerType'), 'referralSummary' => self::getReferrerSummaryForVisit($visit), diff --git a/plugins/PrivacyManager/Controller.php b/plugins/PrivacyManager/Controller.php index 3f34c1829bcfbf6439c97428d2361e1ee8be1adf..c385f84376cff0ac5484f8963cff0a84fab46f96 100644 --- a/plugins/PrivacyManager/Controller.php +++ b/plugins/PrivacyManager/Controller.php @@ -279,7 +279,7 @@ class Controller extends \Piwik\Plugin\ControllerAdmin $deleteDataInfos["nextScheduleTime"] = $nextPossibleSchedule; } else { $deleteDataInfos["lastRun"] = $optionTable; - $deleteDataInfos["lastRunPretty"] = Date::factory((int)$optionTable)->getLocalized('%day% %shortMonth% %longYear%'); + $deleteDataInfos["lastRunPretty"] = Date::factory((int)$optionTable)->getLocalized(Date::DATE_FORMAT_SHORT); //Calculate next run based on last run + interval $nextScheduleRun = (int)($deleteDataInfos["lastRun"] + $deleteDataInfos["config"]["delete_logs_schedule_lowest_interval"] * 24 * 60 * 60); diff --git a/plugins/VisitTime/functions.php b/plugins/VisitTime/functions.php index caba56ecfad2621060f64bcecad099bc97439925..5a9162c6ed1b84e2fc6675837e025a4720e213e5 100644 --- a/plugins/VisitTime/functions.php +++ b/plugins/VisitTime/functions.php @@ -36,5 +36,5 @@ function dayOfWeekFromDate($dateStr) */ function translateDayOfWeek($dayOfWeek) { - return Piwik::translate('Intl_LongDay_' . $dayOfWeek); + return Piwik::translate('Intl_Day_Long_StandAlone_' . $dayOfWeek); } diff --git a/tests/angularjs/bootstrap.js b/tests/angularjs/bootstrap.js index 9483f564597a5c0ce3998f09d00e74b279e8e6bb..77e034051947ef416935ab008d1c5d1855696107 100644 --- a/tests/angularjs/bootstrap.js +++ b/tests/angularjs/bootstrap.js @@ -21,7 +21,7 @@ piwik.hasSuperUserAccess = 1; piwik.config = {}; piwik.config = {"action_url_category_delimiter":"\/","autocomplete_min_sites":"5","datatable_export_range_as_day":"rss"}; -var translations = {"CorePluginsAdmin_NoZipFileSelected":"Please select a ZIP file.","General_InvalidDateRange":"Invalid Date Range, Please Try Again","General_Loading":"Loading...","General_Show":"show","General_Hide":"hide","Intl_YearShort":"yr","General_MultiSitesSummary":"All Websites","CoreHome_YouAreUsingTheLatestVersion":"You are using the latest version of Piwik!","CoreHome_IncludeRowsWithLowPopulation":"Rows with low population are hidden %s Show all rows","CoreHome_ExcludeRowsWithLowPopulation":"All rows are shown %s Exclude low population","CoreHome_DataTableIncludeAggregateRows":"Aggregate rows are hidden %s Show them","CoreHome_DataTableExcludeAggregateRows":"Aggregate rows are shown %s Hide them","CoreHome_Default":"default","CoreHome_PageOf":"%1$s of %2$s","CoreHome_FlattenDataTable":"The report is hierarchical %s Make it flat","CoreHome_UnFlattenDataTable":"The report is flat %s Make it hierarchical","CoreHome_ExternalHelp":"Help (opens in new tab)","SitesManager_NotFound":"No websites found for","Annotations_ViewAndAddAnnotations":"View and add annotations for %s...","General_RowEvolutionRowActionTooltipTitle":"Open Row Evolution","General_RowEvolutionRowActionTooltip":"See how the metrics for this row changed over time","Annotations_IconDesc":"View notes for this date range.","Annotations_IconDescHideNotes":"Hide notes for this date range.","Annotations_HideAnnotationsFor":"Hide annotations for %s...","General_LoadingPopover":"Loading %s...","General_LoadingPopoverFor":"Loading %s for","Intl_ShortMonth_1":"Jan","Intl_ShortMonth_2":"Feb","Intl_ShortMonth_3":"Mar","Intl_ShortMonth_4":"Apr","Intl_ShortMonth_5":"May","Intl_ShortMonth_6":"Jun","Intl_ShortMonth_7":"Jul","Intl_ShortMonth_8":"Aug","Intl_ShortMonth_9":"Sep","Intl_ShortMonth_10":"Oct","Intl_ShortMonth_11":"Nov","Intl_ShortMonth_12":"Dec","Intl_LongMonth_1":"January","Intl_LongMonth_2":"February","Intl_LongMonth_3":"March","Intl_LongMonth_4":"April","Intl_LongMonth_5":"May","Intl_LongMonth_6":"June","Intl_LongMonth_7":"July","Intl_LongMonth_8":"August","Intl_LongMonth_9":"September","Intl_LongMonth_10":"October","Intl_LongMonth_11":"November","Intl_LongMonth_12":"December","Intl_ShortDay_1":"Mon","Intl_ShortDay_2":"Tue","Intl_ShortDay_3":"Wed","Intl_ShortDay_4":"Thu","Intl_ShortDay_5":"Fri","Intl_ShortDay_6":"Sat","Intl_ShortDay_7":"Sun","Intl_LongDay_1":"Monday","Intl_LongDay_2":"Tuesday","Intl_LongDay_3":"Wednesday","Intl_LongDay_4":"Thursday","Intl_LongDay_5":"Friday","Intl_LongDay_6":"Saturday","Intl_LongDay_7":"Sunday","Intl_DayMo":"Mo","Intl_DayTu":"Tu","Intl_DayWe":"We","Intl_DayTh":"Th","Intl_DayFr":"Fr","Intl_DaySa":"Sa","Intl_DaySu":"Su","General_Search":"Search","General_MoreDetails":"More Details","General_Help":"Help","General_MetricsToPlot":"Metrics to plot","General_MetricToPlot":"Metric to plot","General_RecordsToPlot":"Records to plot","General_SaveImageOnYourComputer":"To save the image on your computer, right click on the image and select \"Save Image As...\"","General_ExportAsImage":"Export as Image","General_NoDataForGraph":"No data for this graph.","Widgetize_OpenInNewWindow":"Open in a new window","Dashboard_LoadingWidget":"Loading widget, please wait...","General_TransitionsRowActionTooltipTitle":"Open Transitions","General_TransitionsRowActionTooltip":"See what visitors did before and after viewing this page","Dashboard_AddPreviewedWidget":"Click to add widget to the dashboard","Dashboard_WidgetPreview":"Widget preview","Dashboard_Maximise":"Maximise","Dashboard_Minimise":"Minimise","Dashboard_WidgetNotFound":"Widget not found","Dashboard_DashboardCopied":"Current dashboard successfully copied to selected user.","General_Close":"Close","General_Refresh":"Refresh","General_Website":"Website","General_ColumnNbVisits":"Visits","General_ColumnPageviews":"Pageviews","General_ColumnRevenue":"Revenue","General_TotalVisitsPageviewsRevenue":"(Total: %s visits, %s pageviews, %s revenue)","General_EvolutionSummaryGeneric":"%1$s in %2$s compared to %3$s in %4$s. Evolution: %5$s","General_AllWebsitesDashboard":"All Websites dashboard","General_NVisits":"%s visits","MultiSites_Evolution":"Evolution","SitesManager_AddSite":"Add a new website","General_Next":"Next","General_Previous":"Previous","General_GoTo":"Go to %s","Dashboard_DashboardOf":"Dashboard of %s","Actions_SubmenuSitesearch":"Site Search","MultiSites_LoadingWebsites":"Loading websites","General_ErrorRequest":"Oops\u2026 problem during the request, please try again.","Goals_AddGoal":"Add Goal","Goals_UpdateGoal":"Update Goal","Goals_DeleteGoalConfirm":"Are you sure you want to delete the Goal %s?","UserCountry_FatalErrorDuringDownload":"A fatal error occurred while downloading this file. There might be something wrong with your internet connection, with the GeoIP database you downloaded or Piwik. Try downloading and installing it manually.","UserCountry_SetupAutomaticUpdatesOfGeoIP":"Setup automatic updates of GeoIP databases","General_Done":"Done","Feedback_ThankYou":"Thank you for helping us to make Piwik better!","Feedback_RateFeatureTitle":"Do you like the '%s' feature? Please rate and leave a comment","Feedback_RateFeatureThankYouTitle":"Thank you for rating '%s'!","Feedback_RateFeatureLeaveMessageLike":"We are glad you like it! Please let us know what you like the most or if you have a feature request.","Feedback_RateFeatureLeaveMessageDislike":"We are sorry to hear you don't like it! Please let us know how we can improve.","Feedback_SendFeedback":"Send Feedback","Feedback_RateFeatureSendFeedbackInformation":"Your Piwik platform will send us (the Piwik team) an email (including your email address) so we can get in contact with you if you have any question.","General_Ok":"Ok","General_OrCancel":"or %s Cancel %s","General_Save":"Save","UsersManager_DeleteConfirm":"Are you sure you want to delete the user %s?","UsersManager_ConfirmGrantSuperUserAccess":"Do you really want to grant '%s' Super User access? Warning: the user will have access to all websites and will be able to perform administrative tasks.","UsersManager_ConfirmProhibitOtherUsersSuperUserAccess":"Do you really want to remove Super User access from '%s'? The user will lose all permissions and access to all websites. Make sure to set permissions to needed websites afterwards if necessary.","UsersManager_ConfirmProhibitMySuperUserAccess":"%s, do you really want to remove your own Super User access? You will lose all permissions and access to all websites and will be logged out from Piwik.","SitesManager_OnlyOneSiteAtTime":"You can only edit one website at a time. Please Save or Cancel your current modifications to the website %s.","SitesManager_DeleteConfirm":"Are you sure you want to delete the website %s?","ScheduledReports_ReportSent":"Report sent","ScheduledReports_ReportUpdated":"Report updated","General_OverlayRowActionTooltipTitle":"Open Page Overlay","General_OverlayRowActionTooltip":"See analytics data directly on your website (opens new tab)","CustomAlerts_InvalidMetricValue":"Value must be numeric","Live_VisitorProfile":"Visitor profile","Live_NoMoreVisits":"There are no more visits for this visitor.","Live_ShowMap":"show map","Live_HideMap":"hide map","Live_PageRefreshed":"Number of times this page was viewed \/ refreshed in a row."}; +var translations = {"CorePluginsAdmin_NoZipFileSelected":"Please select a ZIP file.","General_InvalidDateRange":"Invalid Date Range, Please Try Again","General_Loading":"Loading...","General_Show":"show","General_Hide":"hide","Intl_Year_Short":"yr","General_MultiSitesSummary":"All Websites","CoreHome_YouAreUsingTheLatestVersion":"You are using the latest version of Piwik!","CoreHome_IncludeRowsWithLowPopulation":"Rows with low population are hidden %s Show all rows","CoreHome_ExcludeRowsWithLowPopulation":"All rows are shown %s Exclude low population","CoreHome_DataTableIncludeAggregateRows":"Aggregate rows are hidden %s Show them","CoreHome_DataTableExcludeAggregateRows":"Aggregate rows are shown %s Hide them","CoreHome_Default":"default","CoreHome_PageOf":"%1$s of %2$s","CoreHome_FlattenDataTable":"The report is hierarchical %s Make it flat","CoreHome_UnFlattenDataTable":"The report is flat %s Make it hierarchical","CoreHome_ExternalHelp":"Help (opens in new tab)","SitesManager_NotFound":"No websites found for","Annotations_ViewAndAddAnnotations":"View and add annotations for %s...","General_RowEvolutionRowActionTooltipTitle":"Open Row Evolution","General_RowEvolutionRowActionTooltip":"See how the metrics for this row changed over time","Annotations_IconDesc":"View notes for this date range.","Annotations_IconDescHideNotes":"Hide notes for this date range.","Annotations_HideAnnotationsFor":"Hide annotations for %s...","General_LoadingPopover":"Loading %s...","General_LoadingPopoverFor":"Loading %s for","Intl_Month_Short_StandAlone_1":"Jan","Intl_Month_Short_StandAlone_2":"Feb","Intl_Month_Short_StandAlone_3":"Mar","Intl_Month_Short_StandAlone_4":"Apr","Intl_Month_Short_StandAlone_5":"May","Intl_Month_Short_StandAlone_6":"Jun","Intl_Month_Short_StandAlone_7":"Jul","Intl_Month_Short_StandAlone_8":"Aug","Intl_Month_Short_StandAlone_9":"Sep","Intl_Month_Short_StandAlone_10":"Oct","Intl_Month_Short_StandAlone_11":"Nov","Intl_Month_Short_StandAlone_12":"Dec","Intl_Month_Long_StandAlone_1":"January","Intl_Month_Long_StandAlone_2":"February","Intl_Month_Long_StandAlone_3":"March","Intl_Month_Long_StandAlone_4":"April","Intl_Month_Long_StandAlone_5":"May","Intl_Month_Long_StandAlone_6":"June","Intl_Month_Long_StandAlone_7":"July","Intl_Month_Long_StandAlone_8":"August","Intl_Month_Long_StandAlone_9":"September","Intl_Month_Long_StandAlone_10":"October","Intl_Month_Long_StandAlone_11":"November","Intl_Month_Long_StandAlone_12":"December","Intl_Day_Short_StandAlone_1":"Mon","Intl_Day_Short_StandAlone_2":"Tue","Intl_Day_Short_StandAlone_3":"Wed","Intl_Day_Short_StandAlone_4":"Thu","Intl_Day_Short_StandAlone_5":"Fri","Intl_Day_Short_StandAlone_6":"Sat","Intl_Day_Short_StandAlone_7":"Sun","Intl_Day_Long_StandAlone_1":"Monday","Intl_Day_Long_StandAlone_2":"Tuesday","Intl_Day_Long_StandAlone_3":"Wednesday","Intl_Day_Long_StandAlone_4":"Thursday","Intl_Day_Long_StandAlone_5":"Friday","Intl_Day_Long_StandAlone_6":"Saturday","Intl_Day_Long_StandAlone_7":"Sunday","Intl_Day_Min_StandAlone_1":"Mo","Intl_Day_Min_StandAlone_2":"Tu","Intl_Day_Min_StandAlone_3":"We","Intl_Day_Min_StandAlone_4":"Th","Intl_Day_Min_StandAlone_5":"Fr","Intl_Day_Min_StandAlone_6":"Sa","Intl_Day_Min_StandAlone_7":"Su","General_Search":"Search","General_MoreDetails":"More Details","General_Help":"Help","General_MetricsToPlot":"Metrics to plot","General_MetricToPlot":"Metric to plot","General_RecordsToPlot":"Records to plot","General_SaveImageOnYourComputer":"To save the image on your computer, right click on the image and select \"Save Image As...\"","General_ExportAsImage":"Export as Image","General_NoDataForGraph":"No data for this graph.","Widgetize_OpenInNewWindow":"Open in a new window","Dashboard_LoadingWidget":"Loading widget, please wait...","General_TransitionsRowActionTooltipTitle":"Open Transitions","General_TransitionsRowActionTooltip":"See what visitors did before and after viewing this page","Dashboard_AddPreviewedWidget":"Click to add widget to the dashboard","Dashboard_WidgetPreview":"Widget preview","Dashboard_Maximise":"Maximise","Dashboard_Minimise":"Minimise","Dashboard_WidgetNotFound":"Widget not found","Dashboard_DashboardCopied":"Current dashboard successfully copied to selected user.","General_Close":"Close","General_Refresh":"Refresh","General_Website":"Website","General_ColumnNbVisits":"Visits","General_ColumnPageviews":"Pageviews","General_ColumnRevenue":"Revenue","General_TotalVisitsPageviewsRevenue":"(Total: %s visits, %s pageviews, %s revenue)","General_EvolutionSummaryGeneric":"%1$s in %2$s compared to %3$s in %4$s. Evolution: %5$s","General_AllWebsitesDashboard":"All Websites dashboard","General_NVisits":"%s visits","MultiSites_Evolution":"Evolution","SitesManager_AddSite":"Add a new website","General_Next":"Next","General_Previous":"Previous","General_GoTo":"Go to %s","Dashboard_DashboardOf":"Dashboard of %s","Actions_SubmenuSitesearch":"Site Search","MultiSites_LoadingWebsites":"Loading websites","General_ErrorRequest":"Oops\u2026 problem during the request, please try again.","Goals_AddGoal":"Add Goal","Goals_UpdateGoal":"Update Goal","Goals_DeleteGoalConfirm":"Are you sure you want to delete the Goal %s?","UserCountry_FatalErrorDuringDownload":"A fatal error occurred while downloading this file. There might be something wrong with your internet connection, with the GeoIP database you downloaded or Piwik. Try downloading and installing it manually.","UserCountry_SetupAutomaticUpdatesOfGeoIP":"Setup automatic updates of GeoIP databases","General_Done":"Done","Feedback_ThankYou":"Thank you for helping us to make Piwik better!","Feedback_RateFeatureTitle":"Do you like the '%s' feature? Please rate and leave a comment","Feedback_RateFeatureThankYouTitle":"Thank you for rating '%s'!","Feedback_RateFeatureLeaveMessageLike":"We are glad you like it! Please let us know what you like the most or if you have a feature request.","Feedback_RateFeatureLeaveMessageDislike":"We are sorry to hear you don't like it! Please let us know how we can improve.","Feedback_SendFeedback":"Send Feedback","Feedback_RateFeatureSendFeedbackInformation":"Your Piwik platform will send us (the Piwik team) an email (including your email address) so we can get in contact with you if you have any question.","General_Ok":"Ok","General_OrCancel":"or %s Cancel %s","General_Save":"Save","UsersManager_DeleteConfirm":"Are you sure you want to delete the user %s?","UsersManager_ConfirmGrantSuperUserAccess":"Do you really want to grant '%s' Super User access? Warning: the user will have access to all websites and will be able to perform administrative tasks.","UsersManager_ConfirmProhibitOtherUsersSuperUserAccess":"Do you really want to remove Super User access from '%s'? The user will lose all permissions and access to all websites. Make sure to set permissions to needed websites afterwards if necessary.","UsersManager_ConfirmProhibitMySuperUserAccess":"%s, do you really want to remove your own Super User access? You will lose all permissions and access to all websites and will be logged out from Piwik.","SitesManager_OnlyOneSiteAtTime":"You can only edit one website at a time. Please Save or Cancel your current modifications to the website %s.","SitesManager_DeleteConfirm":"Are you sure you want to delete the website %s?","ScheduledReports_ReportSent":"Report sent","ScheduledReports_ReportUpdated":"Report updated","General_OverlayRowActionTooltipTitle":"Open Page Overlay","General_OverlayRowActionTooltip":"See analytics data directly on your website (opens new tab)","CustomAlerts_InvalidMetricValue":"Value must be numeric","Live_VisitorProfile":"Visitor profile","Live_NoMoreVisits":"There are no more visits for this visitor.","Live_ShowMap":"show map","Live_HideMap":"hide map","Live_PageRefreshed":"Number of times this page was viewed \/ refreshed in a row."}; if(typeof(piwik_translations) == 'undefined') { var piwik_translations = new Object; }for(var i in translations) { piwik_translations[i] = translations[i];} var expect = chai.expect