]> source.dussan.org Git - nextcloud-server.git/commitdiff
L10N is here ;-)
authorJakob Sack <kde@jakobsack.de>
Sun, 19 Jun 2011 16:53:02 +0000 (18:53 +0200)
committerJakob Sack <kde@jakobsack.de>
Sun, 19 Jun 2011 16:53:02 +0000 (18:53 +0200)
.gitignore
docs/createtranslation.pl [new file with mode: 0644]
l10n/l10n-de.php [new file with mode: 0644]
lib/l10n.php
log/l10n/de.php [new file with mode: 0644]
log/l10n/de.po [new file with mode: 0644]
log/l10n/log [new file with mode: 0644]
log/l10n/messages.pot [new file with mode: 0644]
log/l10n/xgettextfiles [new file with mode: 0644]
log/templates/index.php

index 9cfb7a5861ed3f2487506b4714fbcf1fba17d262..6a1ffc21cae828415898df6422d20173408e0031 100644 (file)
@@ -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 (file)
index 0000000..4c1c7c3
--- /dev/null
@@ -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 (file)
index 0000000..f3084b0
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+$LOCALIZATIONS = array(
+       'date' => 'd.m.Y',
+       'datetime' => 'd.m.Y H:i:s',
+       'time' => 'H:i:s' );
index e800941e3d3809e3391066640ad0aed085d81e74..4eae109cb522d746ba70ec093e4cc9b714a63a6d 100644 (file)
@@ -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 (file)
index 0000000..5cfc348
--- /dev/null
@@ -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 (file)
index 0000000..a901754
--- /dev/null
@@ -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 (file)
index 0000000..e5e074b
--- /dev/null
@@ -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 (file)
index 0000000..2da2355
--- /dev/null
@@ -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 (file)
index 0000000..a24bcc8
--- /dev/null
@@ -0,0 +1 @@
+../templates/index.php 
index 5f398b1dbc61acd645c7a8043bde0f163678980a..2756332f519eee4561efc25f8b48b11e62d333d2 100644 (file)
@@ -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'/>&nbsp;entries per page.
+                       <span><?php echo $l->t( 'Show:' ); ?></span>
+                       <input type="text" maxlength="3" size="3" value="<?php echo $_['size']?>" name='size'/>&nbsp;<?php echo $l->t( 'entries per page.' ); ?>
                        <input class="prettybutton" type="submit" name="save" value="Save" />
 
                </p>
 <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" />