]> source.dussan.org Git - nextcloud-server.git/commitdiff
Translation of calendar interface
authorBart Visscher <bartv@thisnet.nl>
Tue, 18 Oct 2011 18:42:22 +0000 (20:42 +0200)
committerBart Visscher <bartv@thisnet.nl>
Thu, 20 Oct 2011 21:49:27 +0000 (23:49 +0200)
apps/calendar/js/calendar.js
apps/calendar/templates/calendar.php
lib/l10n.php

index 876465a0e53a88f1ffe7f96aa135a6b58d5e779e..f8456c9bc08d73769bf6e5b1fbfc567f107bb8d4 100644 (file)
@@ -662,9 +662,21 @@ $(document).ready(function(){
                header: false,
                firstDay: 1,
                editable: true,
+               defaultView: defaultView,
+               timeFormat: {
+                       agenda: 'HH:mm{ - HH:mm}',
+                       '': 'HH:mm'
+                       },
+               axisFormat: 'HH:mm',
+               monthNames: monthNames,
+               monthNamesShort: monthNamesShort,
+               dayNames: dayNames,
+               dayNamesShort: dayNamesShort,
+               allDayText: allDayText,
                eventSources: eventSources,
                viewDisplay: function(view) {
                        $('#datecontrol_date').html(view.title);
+                       $.get(OC.filePath('calendar', 'ajax', 'changeview.php') + "?v="+view.name);
                }
        });
        $('#oneweekview_radio').click(function(){
index d09a5d45a1a6ffe3126464e680e49379640c657a..58f61661ce3be492c316eff61d85134f74d6f7da 100644 (file)
@@ -1,5 +1,11 @@
 <script type='text/javascript'>
+var defaultView = '<?php echo OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') ?>';
 var eventSources = <?php echo json_encode($_['eventSources']) ?>;
+var dayNames = <?php echo json_encode($l->tA(array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'))) ?>;
+var dayNamesShort = <?php echo json_encode($l->tA(array('Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.'))) ?>;
+var monthNames = <?php echo json_encode($l->tA(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'))) ?>;
+var monthNamesShort = <?php echo json_encode($l->tA(array('Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'))) ?>;
+var allDayText = '<?php echo $l->t('All day') ?>';
 </script>
                                <div id="sysbox"></div>
                                <div id="controls">
index 54331d44ae40f31e1c14710b00f5458cf50d9b67..a5544eb3a2766c95e8aaed053ce05e946f04495c 100644 (file)
@@ -109,6 +109,22 @@ class OC_L10N{
                return vsprintf($text, $parameters);
        }
 
+       /**
+        * @brief Translating
+        * @param $textArray The text array we need a translation for
+        * @returns Translation or the same text
+        *
+        * Returns the translation. If no translation is found, $textArray will be
+        * returned.
+        */
+       public function tA($textArray){
+               $result = array();
+               foreach($textArray as $key => $text){
+                       $result[$key] = $this->t($text);
+               }
+               return $result;
+       }
+
        /**
         * @brief getTranslations
         * @returns Fetch all translations