From a24d8db4b25e99f92ebb2cb65a97672f39a2f85f Mon Sep 17 00:00:00 2001 From: scambra Date: Fri, 21 Sep 2012 08:11:11 +0200 Subject: [PATCH 1/2] translate datepicker --- core/js/share.js | 8 ++++++++ core/l10n/l10n-de.php | 3 ++- core/l10n/l10n-en.php | 3 ++- core/l10n/l10n-es.php | 3 ++- core/templates/layout.user.php | 3 +++ lib/l10n.php | 5 ++++- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/core/js/share.js b/core/js/share.js index de50e53a44..1bc8f55568 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -343,6 +343,14 @@ OC.Share={ } $(document).ready(function() { + $.datepicker.setDefaults({ + monthNames: monthNames, + monthNamesShort: $.map(monthNames, function(v) { return v.slice(0,3)+'.'; }), + dayNames: dayNames, + dayNamesMin: $.map(dayNames, function(v) { return v.slice(0,2); }), + dayNamesShort: $.map(dayNames, function(v) { return v.slice(0,3)+'.'; }), + firstDay: firstDay + }); $('a.share').live('click', function(event) { event.stopPropagation(); diff --git a/core/l10n/l10n-de.php b/core/l10n/l10n-de.php index 976f8ce3c5..d80c3beb2b 100644 --- a/core/l10n/l10n-de.php +++ b/core/l10n/l10n-de.php @@ -2,4 +2,5 @@ $LOCALIZATIONS = array( 'date' => '%d.%m.%Y', 'datetime' => '%d.%m.%Y %H:%M:%S', - 'time' => '%H:%M:%S' ); + 'time' => '%H:%M:%S', + 'firstday' => 0 ); diff --git a/core/l10n/l10n-en.php b/core/l10n/l10n-en.php index 3a050d477c..6268214b50 100644 --- a/core/l10n/l10n-en.php +++ b/core/l10n/l10n-en.php @@ -2,4 +2,5 @@ $LOCALIZATIONS = array( 'date' => '%B %e, %Y', 'datetime' => '%B %e, %Y %H:%M', - 'time' => '%H:%M:%S' ); + 'time' => '%H:%M:%S', + 'firstday' => 0 ); diff --git a/core/l10n/l10n-es.php b/core/l10n/l10n-es.php index b81464b491..8798b24d62 100644 --- a/core/l10n/l10n-es.php +++ b/core/l10n/l10n-es.php @@ -2,4 +2,5 @@ $LOCALIZATIONS = array( 'date' => '%e de %B de %Y', 'datetime' => '%e de %B de %Y %H:%M', - 'time' => '%H:%M:%S' ); + 'time' => '%H:%M:%S', + 'firstday' => 1 ); diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index b6d8a7604a..92d47cc51f 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -13,6 +13,9 @@ var oc_current_user = ''; var oc_requesttoken = ''; var oc_requestlifespan = ''; + var dayNames = t('Sunday'), (string)$l->t('Monday'), (string)$l->t('Tuesday'), (string)$l->t('Wednesday'), (string)$l->t('Thursday'), (string)$l->t('Friday'), (string)$l->t('Saturday'))) ?>; + var monthNames = t('January'), (string)$l->t('February'), (string)$l->t('March'), (string)$l->t('April'), (string)$l->t('May'), (string)$l->t('June'), (string)$l->t('July'), (string)$l->t('August'), (string)$l->t('September'), (string)$l->t('October'), (string)$l->t('November'), (string)$l->t('December'))) ?>; + var firstDay = l('firstday')) ?>; diff --git a/lib/l10n.php b/lib/l10n.php index 2661153717..72ac9e353d 100644 --- a/lib/l10n.php +++ b/lib/l10n.php @@ -60,7 +60,8 @@ class OC_L10N{ private $localizations = array( 'date' => '%d.%m.%Y', 'datetime' => '%d.%m.%Y %H:%M:%S', - 'time' => '%H:%M:%S'); + 'time' => '%H:%M:%S', + 'firstday' => 0); /** * get an L10N instance @@ -221,6 +222,8 @@ class OC_L10N{ setlocale(LC_TIME, $locales); return strftime($this->localizations[$type], $data); break; + case 'firstday': + return $this->localizations[$type]; default: return false; } From 41b597e179a694973c709613cdf41e2b379c8df9 Mon Sep 17 00:00:00 2001 From: scambra Date: Fri, 21 Sep 2012 08:33:26 +0200 Subject: [PATCH 2/2] Translate formatDate using jquery datepicker --- core/js/js.js | 4 +--- core/l10n/l10n-de.php | 1 + core/l10n/l10n-en.php | 1 + core/l10n/l10n-es.php | 1 + core/templates/layout.user.php | 1 + lib/l10n.php | 2 ++ 6 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/js/js.js b/core/js/js.js index ba8020c89e..c5e32f3c27 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -667,9 +667,7 @@ function formatDate(date){ if(typeof date=='number'){ date=new Date(date); } - var monthNames = [ t('files','January'), t('files','February'), t('files','March'), t('files','April'), t('files','May'), t('files','June'), - t('files','July'), t('files','August'), t('files','September'), t('files','October'), t('files','November'), t('files','December') ]; - return monthNames[date.getMonth()]+' '+date.getDate()+', '+date.getFullYear()+', '+((date.getHours()<10)?'0':'')+date.getHours()+':'+((date.getMinutes()<10)?'0':'')+date.getMinutes(); + return $.datepicker.formatDate(datepickerFormatDate, date)+' '+date.getHours()+':'+((date.getMinutes()<10)?'0':'')+date.getMinutes(); } /** diff --git a/core/l10n/l10n-de.php b/core/l10n/l10n-de.php index d80c3beb2b..77d35af493 100644 --- a/core/l10n/l10n-de.php +++ b/core/l10n/l10n-de.php @@ -1,5 +1,6 @@ 'dd.mm.yy', 'date' => '%d.%m.%Y', 'datetime' => '%d.%m.%Y %H:%M:%S', 'time' => '%H:%M:%S', diff --git a/core/l10n/l10n-en.php b/core/l10n/l10n-en.php index 6268214b50..9ee748bee2 100644 --- a/core/l10n/l10n-en.php +++ b/core/l10n/l10n-en.php @@ -1,5 +1,6 @@ 'MM d, yy', 'date' => '%B %e, %Y', 'datetime' => '%B %e, %Y %H:%M', 'time' => '%H:%M:%S', diff --git a/core/l10n/l10n-es.php b/core/l10n/l10n-es.php index 8798b24d62..13db2ec5d4 100644 --- a/core/l10n/l10n-es.php +++ b/core/l10n/l10n-es.php @@ -1,5 +1,6 @@ "d 'de' MM 'de' yy", 'date' => '%e de %B de %Y', 'datetime' => '%e de %B de %Y %H:%M', 'time' => '%H:%M:%S', diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 92d47cc51f..1f16fdf7c6 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -13,6 +13,7 @@ var oc_current_user = ''; var oc_requesttoken = ''; var oc_requestlifespan = ''; + var datepickerFormatDate = l('jsdate')) ?>; var dayNames = t('Sunday'), (string)$l->t('Monday'), (string)$l->t('Tuesday'), (string)$l->t('Wednesday'), (string)$l->t('Thursday'), (string)$l->t('Friday'), (string)$l->t('Saturday'))) ?>; var monthNames = t('January'), (string)$l->t('February'), (string)$l->t('March'), (string)$l->t('April'), (string)$l->t('May'), (string)$l->t('June'), (string)$l->t('July'), (string)$l->t('August'), (string)$l->t('September'), (string)$l->t('October'), (string)$l->t('November'), (string)$l->t('December'))) ?>; var firstDay = l('firstday')) ?>; diff --git a/lib/l10n.php b/lib/l10n.php index 72ac9e353d..18706e4b4a 100644 --- a/lib/l10n.php +++ b/lib/l10n.php @@ -58,6 +58,7 @@ class OC_L10N{ * Localization */ private $localizations = array( + 'jsdate' => 'dd.mm.yy', 'date' => '%d.%m.%Y', 'datetime' => '%d.%m.%Y %H:%M:%S', 'time' => '%H:%M:%S', @@ -223,6 +224,7 @@ class OC_L10N{ return strftime($this->localizations[$type], $data); break; case 'firstday': + case 'jsdate': return $this->localizations[$type]; default: return false;