caldav-client

standalone CalDAV web client
git clone https://git.ce9e.org/caldav-client.git

commit
7409142797a1d8704983c2b168c271ddb022ebc6
parent
52338495ec559f16559382d88ad234a41ac3b531
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2022-02-04 17:07
add translation

Diffstat

M main.js 25 ++++++++++++++++++++++++-

1 files changed, 24 insertions, 1 deletions


diff --git a/main.js b/main.js

@@ -4,6 +4,25 @@ import * as dav from './dav.js';
    4     4 var selectedEvent = null;
    5     5 var form = document.querySelector('form');
    6     6 
   -1     7 var translations = {
   -1     8     'de': {
   -1     9         'Title': 'Titel',
   -1    10         'All day': 'Ganzer Tag',
   -1    11         'Start': 'Anfang',
   -1    12         'End': 'Ende',
   -1    13         'Calendar': 'Kalender',
   -1    14         'Save': 'Speichern',
   -1    15         'Delete': 'Löschen',
   -1    16         'Cancel': 'Abbrechen',
   -1    17         'Are you sure you want to delete this?': 'Bist du sicher dass du das löschen willst?',
   -1    18     },
   -1    19 };
   -1    20 
   -1    21 var _ = function(s) {
   -1    22     var lang = translations[navigator.language] || {};
   -1    23     return lang[s] || s;
   -1    24 };
   -1    25 
    7    26 var openForm = function(event) {
    8    27     form.reset();
    9    28     form.title.value = event.title;
@@ -25,11 +44,15 @@ var closeForm = function() {
   25    44     calendar.render();
   26    45 };
   27    46 
   -1    47 form.querySelectorAll('[data-translate]').forEach(el => {
   -1    48     el.textContent = _(el.textContent);
   -1    49 });
   -1    50 
   28    51 form.addEventListener('submit', function(e) {
   29    52     e.preventDefault();
   30    53 
   31    54     if (e.submitter.value === 'delete') {
   32    -1         if (!confirm('Are you sure you want to delete this?')) {
   -1    55         if (!confirm(_('Are you sure you want to delete this?'))) {
   33    56             return;
   34    57         }
   35    58         calendar.getEvents()