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
diff options
context:
space:
mode:
authorJakob Sack <kde@jakobsack.de>2011-06-19 20:53:02 +0400
committerJakob Sack <kde@jakobsack.de>2011-06-19 20:53:02 +0400
commite8e483d07943e7c4874ee6147e3910ee868ed14d (patch)
tree89882cd925556fb09629dbab5818ca978dbfee60 /lib/l10n.php
parentabac11d8c42fdc3e93bbfc65d8e30474d3bb876a (diff)
L10N is here ;-)
Diffstat (limited to 'lib/l10n.php')
-rw-r--r--lib/l10n.php17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/l10n.php b/lib/l10n.php
index e800941e3d3..4eae109cb52 100644
--- a/lib/l10n.php
+++ b/lib/l10n.php
@@ -57,32 +57,33 @@ class OC_L10N{
* language.
*/
public function __construct( $app, $lang = null ){
+ global $SERVERROOT;
// Find the right language
if( is_null( $lang )){
- self::findLanguage( $app );
+ $lang = self::findLanguage( $app );
}
// Use cache if possible
if(array_key_exists($app.'::'.$lang, self::$cache )){
+
$this->translations = self::$cache[$app.'::'.$lang]['t'];
$this->localizations = self::$cache[$app.'::'.$lang]['l'];
}
else{
$i18ndir = self::findI18nDir( $app );
-
// Localization is in /l10n, Texts are in $i18ndir
// (Just no need to define date/time format etc. twice)
- if( file_exists( $i18ndir.$lang.'php' )){
+ if( file_exists( $i18ndir.$lang.'.php' )){
// Include the file, save the data from $CONFIG
- include( $i18ndir.$lang.'php' );
+ include( $i18ndir.$lang.'.php' );
if( isset( $TRANSLATIONS ) && is_array( $TRANSLATIONS )){
$this->translations = $TRANSLATIONS;
}
}
- if( file_exists( '/l10n/l10n-'.$lang.'php' )){
+ if( file_exists( $SERVERROOT.'/l10n/l10n-'.$lang.'.php' )){
// Include the file, save the data from $CONFIG
- include( $SERVERROOT.'/l10n/l10n-'.$lang.'php' );
+ include( $SERVERROOT.'/l10n/l10n-'.$lang.'.php' );
if( isset( $LOCALIZATIONS ) && is_array( $LOCALIZATIONS )){
$this->localizations = array_merge( $this->localizations, $LOCALIZATIONS );
}
@@ -133,12 +134,15 @@ class OC_L10N{
public function l($type, $data){
switch($type){
case 'date':
+ if( is_string( $data )) $data = strtotime( $data );
return date( $this->localizations['date'], $data );
break;
case 'datetime':
+ if( is_string( $data )) $data = strtotime( $data );
return date( $this->localizations['datetime'], $data );
break;
case 'time':
+ if( is_string( $data )) $data = strtotime( $data );
return date( $this->localizations['time'], $data );
break;
default:
@@ -209,7 +213,6 @@ class OC_L10N{
$accepted_languages = preg_split( '/,\s*/', $_SERVER['HTTP_ACCEPT_LANGUAGE'] );
foreach( $accepted_languages as $i ){
$temp = explode( ';', $i );
- $temp = explode( '-', $temp[0] );
if( array_key_exists( $temp[0], $available )){
return $temp[0];
}