diff options
author | Jakob Sack <kde@jakobsack.de> | 2011-06-19 18:53:02 +0200 |
---|---|---|
committer | Jakob Sack <kde@jakobsack.de> | 2011-06-19 18:53:02 +0200 |
commit | e8e483d07943e7c4874ee6147e3910ee868ed14d (patch) | |
tree | 89882cd925556fb09629dbab5818ca978dbfee60 | |
parent | abac11d8c42fdc3e93bbfc65d8e30474d3bb876a (diff) | |
download | nextcloud-server-e8e483d07943e7c4874ee6147e3910ee868ed14d.tar.gz nextcloud-server-e8e483d07943e7c4874ee6147e3910ee868ed14d.zip |
L10N is here ;-)
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | docs/createtranslation.pl | 28 | ||||
-rw-r--r-- | l10n/l10n-de.php | 5 | ||||
-rw-r--r-- | lib/l10n.php | 17 | ||||
-rw-r--r-- | log/l10n/de.php | 14 | ||||
-rw-r--r-- | log/l10n/de.po | 68 | ||||
-rw-r--r-- | log/l10n/log | 3 | ||||
-rw-r--r-- | log/l10n/messages.pot | 66 | ||||
-rw-r--r-- | log/l10n/xgettextfiles | 1 | ||||
-rw-r--r-- | log/templates/index.php | 26 |
10 files changed, 214 insertions, 20 deletions
diff --git a/.gitignore b/.gitignore index 9cfb7a5861e..6a1ffc21cae 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,11 @@ _darcs/* CVS/* .svn/* RCS/* + +# kdevelop .kdev *.kdev4 + +# Lokalize +*lokalize* + diff --git a/docs/createtranslation.pl b/docs/createtranslation.pl new file mode 100644 index 00000000000..4c1c7c38d73 --- /dev/null +++ b/docs/createtranslation.pl @@ -0,0 +1,28 @@ +#!/usr/bin/perl +use strict; +use Locale::PO; +use Data::Dumper; + +opendir( DIR, '.' ); +my @files = readdir( DIR ); +closedir( DIR ); + +foreach my $i ( @files ){ + next unless $i =~ m/^(.*)\.po$/; + my $lang = $1; + my $hash = Locale::PO->load_file_ashash( $i ); + + # Create array + my @strings = (); + foreach my $key ( keys( %{$hash} )){ + next if $key eq '""'; + push( @strings, $hash->{$key}->msgid()." => ".$hash->{$key}->msgstr()); + } + + # Write PHP file + open( OUT, ">$lang.php" ); + print OUT "<?php \$TRANSLATIONS = array(\n"; + print OUT join( ",\n", @strings ); + print OUT "\n);\n"; + close( OUT ); +}
\ No newline at end of file diff --git a/l10n/l10n-de.php b/l10n/l10n-de.php new file mode 100644 index 00000000000..f3084b05df8 --- /dev/null +++ b/l10n/l10n-de.php @@ -0,0 +1,5 @@ +<?php +$LOCALIZATIONS = array( + 'date' => 'd.m.Y', + 'datetime' => 'd.m.Y H:i:s', + 'time' => 'H:i:s' ); 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]; } diff --git a/log/l10n/de.php b/log/l10n/de.php new file mode 100644 index 00000000000..5cfc3486aff --- /dev/null +++ b/log/l10n/de.php @@ -0,0 +1,14 @@ +<?php $TRANSLATIONS = array( +"Show:" => "Zeige", +"Uploads" => "Uploads", +"Filter:" => "Filter:", +"Logouts" => "Abmeldungen", +"Logins" => "Anmeldungen", +"When" => "Wann", +"Downloads" => "Downloads", +"Clear log entries before" => "Lösche Einträge vor dem", +"What" => "Was", +"entries per page." => "Einträge pro Seite", +"Creations" => "Erstellungen", +"Deletions" => "Löschungen" +); diff --git a/log/l10n/de.po b/log/l10n/de.po new file mode 100644 index 00000000000..a901754f1a6 --- /dev/null +++ b/log/l10n/de.po @@ -0,0 +1,68 @@ +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Jakob Sack <mail@jakobsack.de>, 2011. +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2011-06-19 16:44+0200\n" +"PO-Revision-Date: 2011-06-19 16:54+0200\n" +"Last-Translator: Jakob Sack <mail@jakobsack.de>\n" +"Language-Team: German <kde-i18n-de@kde.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Lokalize 1.2\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: ../templates/index.php:4 +msgid "Filter:" +msgstr "Filter:" + +#: ../templates/index.php:7 +msgid "Logins" +msgstr "Anmeldungen" + +#: ../templates/index.php:8 +msgid "Logouts" +msgstr "Abmeldungen" + +#: ../templates/index.php:9 +msgid "Downloads" +msgstr "Downloads" + +#: ../templates/index.php:10 +msgid "Uploads" +msgstr "Uploads" + +#: ../templates/index.php:11 +msgid "Creations" +msgstr "Erstellungen" + +#: ../templates/index.php:12 +msgid "Deletions" +msgstr "Löschungen" + +#: ../templates/index.php:15 +msgid "Show:" +msgstr "Zeige" + +#: ../templates/index.php:16 +msgid "entries per page." +msgstr "Einträge pro Seite" + +#: ../templates/index.php:26 +msgid "What" +msgstr "Was" + +#: ../templates/index.php:27 +msgid "When" +msgstr "Wann" + +#: ../templates/index.php:45 +msgid "Clear log entries before" +msgstr "Lösche Einträge vor dem" + + diff --git a/log/l10n/log b/log/l10n/log new file mode 100644 index 00000000000..e5e074bf9aa --- /dev/null +++ b/log/l10n/log @@ -0,0 +1,3 @@ +[General] +LangCode=de +TargetLangCode=de diff --git a/log/l10n/messages.pot b/log/l10n/messages.pot new file mode 100644 index 00000000000..2da2355a3ab --- /dev/null +++ b/log/l10n/messages.pot @@ -0,0 +1,66 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2011-06-19 16:53+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../templates/index.php:4 +msgid "Filter:" +msgstr "" + +#: ../templates/index.php:7 +msgid "Logins" +msgstr "" + +#: ../templates/index.php:8 +msgid "Logouts" +msgstr "" + +#: ../templates/index.php:9 +msgid "Downloads" +msgstr "" + +#: ../templates/index.php:10 +msgid "Uploads" +msgstr "" + +#: ../templates/index.php:11 +msgid "Creations" +msgstr "" + +#: ../templates/index.php:12 +msgid "Deletions" +msgstr "" + +#: ../templates/index.php:15 +msgid "Show:" +msgstr "" + +#: ../templates/index.php:16 +msgid "entries per page." +msgstr "" + +#: ../templates/index.php:26 +msgid "What" +msgstr "" + +#: ../templates/index.php:27 +msgid "When" +msgstr "" + +#: ../templates/index.php:45 +msgid "Clear log entries before" +msgstr "" diff --git a/log/l10n/xgettextfiles b/log/l10n/xgettextfiles new file mode 100644 index 00000000000..a24bcc89a85 --- /dev/null +++ b/log/l10n/xgettextfiles @@ -0,0 +1 @@ +../templates/index.php diff --git a/log/templates/index.php b/log/templates/index.php index 5f398b1dbc6..2756332f519 100644 --- a/log/templates/index.php +++ b/log/templates/index.php @@ -1,19 +1,19 @@ <div class="controls"> <form id="logs_options" method='post'> <p> - <span>Filter :</span> + <span><?php echo $l->t( 'Filter:' ); ?></span> <input type="checkbox" checked="" name="all" id="all" /> <label for="all">All</label> - <input type="checkbox" class='action' <?php echo $_['showActions']['login']?> name="login" id="logins" /> <label for="logins">Logins</label> - <input type="checkbox" class='action' <?php echo $_['showActions']['logout']?> name="logout" id="logouts" /> <label for="logouts">Logouts</label> - <input type="checkbox" class='action' <?php echo $_['showActions']['read']?> name="read" id="downloads" /> <label for="downloads">Downloads</label> - <input type="checkbox" class='action' <?php echo $_['showActions']['write']?> name="write" id="uploads" /> <label for="uploads">Uploads</label> - <input type="checkbox" class='action' <?php echo $_['showActions']['create']?> name="create" id="creations" /> <label for="creations">Creations</label> - <input type="checkbox" class='action' <?php echo $_['showActions']['delete']?> name="delete" id="deletions" /> <label for="deletions">Deletions</label> + <input type="checkbox" class='action' <?php echo $_['showActions']['login']?> name="login" id="logins" /> <label for="logins"><?php echo $l->t( 'Logins' ); ?></label> + <input type="checkbox" class='action' <?php echo $_['showActions']['logout']?> name="logout" id="logouts" /> <label for="logouts"><?php echo $l->t( 'Logouts' ); ?></label> + <input type="checkbox" class='action' <?php echo $_['showActions']['read']?> name="read" id="downloads" /> <label for="downloads"><?php echo $l->t( 'Downloads' ); ?></label> + <input type="checkbox" class='action' <?php echo $_['showActions']['write']?> name="write" id="uploads" /> <label for="uploads"><?php echo $l->t( 'Uploads' ); ?></label> + <input type="checkbox" class='action' <?php echo $_['showActions']['create']?> name="create" id="creations" /> <label for="creations"><?php echo $l->t( 'Creations' ); ?></label> + <input type="checkbox" class='action' <?php echo $_['showActions']['delete']?> name="delete" id="deletions" /> <label for="deletions"><?php echo $l->t( 'Deletions' ); ?></label> </p> <p> - <span>Show :</span> - <input type="text" maxlength="3" size="3" value="<?php echo $_['size']?>" name='size'/> entries per page. + <span><?php echo $l->t( 'Show:' ); ?></span> + <input type="text" maxlength="3" size="3" value="<?php echo $_['size']?>" name='size'/> <?php echo $l->t( 'entries per page.' ); ?> <input class="prettybutton" type="submit" name="save" value="Save" /> </p> @@ -23,15 +23,15 @@ <table cellspacing="0"> <thead> <tr> - <th>What</th> - <th>When</th> + <th><?php echo $l->t( 'What' ); ?></th> + <th><?php echo $l->t( 'When' ); ?></th> </tr> </thead> <tbody> <?php foreach($_["logs"] as $entry): ?> <tr> <td class="<?php echo $entry["action"]; ?>"><em><?php echo $entry["action"]; ?> <?php echo $entry["user"]; ?></em> <?php echo $entry["info"]; ?></td> - <td class="date"><?php echo $entry["date"]; ?></td> + <td class="date"><?php echo $l->l('datetime', $entry["date"] ); ?></td> </tr> <?php endforeach; ?> </tbody> @@ -42,7 +42,7 @@ <div class="controls"> <form id="logs_options" method='post'> <p> - <span>Clear log entries before </span> + <span><?php echo $l->t( 'Clear log entries before' ); ?> </span> <input type="date" id="removeBeforeDate" name="removeBeforeDate"/> <input class="prettybutton nofloat" type="submit" name="clear" value="Clear" /> <input class="prettybutton" type="submit" name="clearall" value="Clear All" /> |