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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorscambra <sergio@entrecables.com>2012-06-07 16:44:59 +0400
committerscambra <sergio@entrecables.com>2012-10-16 22:19:35 +0400
commitec253f1354b6993cf204ee60ec87350119a3c91e (patch)
tree0b8d8fd2efdf6c74bcacba7822fb96c5736e518e /lib
parente7c9d5fe54ec619793ae77829b93df4635279662 (diff)
Use strftime to format date with translated month names
Diffstat (limited to 'lib')
-rw-r--r--lib/l10n.php10
-rwxr-xr-xlib/util.php4
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/l10n.php b/lib/l10n.php
index 4eb4c323d88..7df01ced72f 100644
--- a/lib/l10n.php
+++ b/lib/l10n.php
@@ -58,9 +58,9 @@ class OC_L10N{
* Localization
*/
private $localizations = array(
- 'date' => 'd.m.Y',
- 'datetime' => 'd.m.Y H:i:s',
- 'time' => 'H:i:s');
+ 'date' => '%d.%m.%Y',
+ 'datetime' => '%d.%m.%Y %H:%M:%S',
+ 'time' => '%H:%M:%S');
/**
* get an L10N instance
@@ -216,7 +216,9 @@ class OC_L10N{
case 'time':
if($data instanceof DateTime) return $data->format($this->localizations[$type]);
elseif(is_string($data)) $data = strtotime($data);
- return date($this->localizations[$type], $data);
+ $language = self::findLanguage();
+ setlocale(LC_TIME, array($language, $language.'_'.strtoupper($language)));
+ return strftime($this->localizations[$type], $data);
break;
default:
return false;
diff --git a/lib/util.php b/lib/util.php
index 5771b89f265..880a519d347 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -162,8 +162,8 @@ class OC_Util {
$offset=$clientTimeZone-$systemTimeZone;
$timestamp=$timestamp+$offset*60;
}
- $timeformat=$dateOnly?'F j, Y':'F j, Y, H:i';
- return date($timeformat,$timestamp);
+ $l=OC_L10N::get('lib');
+ return $l->l($dateOnly ? 'date' : 'datetime', $timestamp);
}
/**