]> git.plutz.net Git - confetti/blob - l10n.sh
always sort categories, caching and ordering for list in course filter
[confetti] / l10n.sh
1 # Copyright 2014, 2016, 2019, 2021 Paul Hänsch
2 #
3 # This file is part of Confetti.
4
5 # Confetti is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9
10 # Confetti is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU Affero General Public License for more details.
14
15 # You should have received a copy of the GNU Affero General Public License
16 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
17
18 l10n(){
19   local word
20   [ $# -eq 0 ] && read -r word || word="$*"
21   l10n_global "$word"
22 }
23
24 l10n_global() {
25   case $1 in
26     # Nav Menu
27     cards) printf %s "Teil&shy;neh&shy;mende";;
28     courses) printf %s "Kurse";;
29
30     # VCF Default
31     PHOTO) printf %s "Foto";;
32     LOGO) printf %s "Logo";;
33     FN) printf %s "Voller Name";;
34     N) printf %s "Name";;
35     n_pre) printf %s "Titel";;
36     n_first) printf %s "Vorname";;
37     n_middle) printf %s "Mittel&shy;namen";;
38     n_last) printf %s "Nachname";;
39     n_post) printf %s "Zusätze";;
40     NICKNAME) printf %s "Spitz&shy;name";;
41     SOUND) printf %s "Aus&shy;sprache";;
42     GENDER) printf %s "Ge&shy;schlecht";;
43     KIND) printf %s "Typ";;
44     TITLE) printf %s "Beruf";;
45     ROLE) printf %s "Position";;
46     ORG) printf %s "Orga&shy;ni&shy;sation";;
47     MEMBER) printf %s "Mitglied";;
48     CATEGORIES) printf %s "Kategorien";;
49     ANNIVERSARY) printf %s "Jubiläum";;
50     BDAY) printf %s "Geburtstag";;
51     EMAIL) printf %s "E-Mail";;
52     TEL) printf %s "Telefon";;
53     teltype) printf %s "Anschluss&shy;typ:";;
54     TYPE=HOME) printf %s "Privat";;
55     TYPE=WORK) printf %s "Geschäft&shy;lich";;
56     TYPE=CELL) printf %s "Mobil";;
57     TYPE=FAX) printf %s "Fax";;
58     IMPP) printf %s "Chat";;
59     ADR) printf %s "Anschrift";;
60     URL) printf %s "Webseite";;
61     LANG) printf %s "Sprache";;
62     NOTE) printf %s "Notiz";;
63     RELATED) printf %s "Kontakte";;
64
65     # ICS Default
66     SUMMARY) printf "Bezeichnung";;
67     COMMENT) printf "Kommentar";;
68     DTSTART) printf "Beginn";;
69     DURATION) printf "Dauer";;
70     RRULE) printf "Regelmäßigkeit";;
71     DAILY) printf "Tage";;
72     WEEKLY) printf "Wochen";;
73     MONTHLY) printf "Monate";;
74     YEARLY) printf "Jahre";;
75     sDAILY) printf "Täglich";;
76     sWEEKLY) printf "Wöchentlich";;
77     sMONTHLY) printf "Monatlich";;
78     sYEARLY) printf "Jährlich";;
79
80     # UI labels
81     year) printf %s "Jahr";;
82     month) printf %s "Monat";;
83     day) printf %s "Tag";;
84     edit) printf %s "Bearbeiten";;
85     edit_categories) printf %s "Kategorien Bearbeiten";;
86     vcf_export) printf %s "Vcard Exportieren";;
87     control) printf %s "Aktionen";;
88     delete) printf %s "entfernen";;
89     edit_update) printf %s "Daten übernehmen";;
90     edit_cancel) printf %s "Abbrechen";;
91     edit_delete) printf %s "Eintrag löschen";;
92     edit_addfieldtext) printf %s "Neues Feld";;
93     edit_addfield) printf %s "+";;
94     edit_deletefield) printf %s "X";;
95
96     filter_label) printf %s "Filter";;
97     filter_item) printf %s "Eingrenzung nach";;
98     filter_placeholder) printf %s "Begriffe zur Eingrenzung eingeben";;
99     filter_type) printf %s "Filter&shy;typ";;
100     filter_order) printf %s "Sortie&shy;rung";;
101     filter_any) printf %s "Alles";;
102     filter_name) printf %s "Name";;
103     filter_firstname) printf %s "Vor&shy;name";;
104     filter_lastname) printf %s "Nach&shy;name";;
105     filter_street) printf %s "Straße";;
106     filter_zip) printf %s "PLZ.";;
107     filter_TEL) printf %s "Tele&shy;fon";;
108     filter_BDAY) printf %s "Geburts&shy;jahr";;
109     filter_bdate) printf %s "Geburts&shy;datum";;
110     filter_course) printf %s "Kurs";;
111     filter_CATEGORIES) printf %s "Kate&shy;go&shy;rien";;
112     filter_more) printf %s "+ mehr Filter";;
113     filter_apply) printf %s "Filtern";;
114     filter_cancel) printf %s "Filter löschen";;
115     export_csv) printf %s "Liste als CSV-Datei";;
116
117     # UI Labels Special
118     course_attendance) printf %s "Kurs&shy;teil&shy;nahme";;
119     vcf_seed_label) printf "Anmeld.     Vorn.   Nachn.  Geb. Monat      Geb. Jahr       Tel.    Mobil   ()      EMail   ()      Notiz";;
120   
121     gender_none) printf %s "keine Angabe";;
122     gender_female) printf %s "Weiblich";;
123     gender_male) printf %s "Männlich";;
124     gender_other) printf %s "Sonstiges";;
125   
126     female) printf %s "&#x2640;";;
127     male) printf %s "&#x2642;";;
128     other) printf %s "&#x26A5;";;
129     none) printf %s "&#x26AA;";;
130
131     # Fallback
132     *) printf %s "$word";;
133   esac
134 }
135
136 l10n_time() {
137   [ $# -eq 0 ] && read -r time || time="$*"
138   printf '%s\n' "$time" |sed -E '
139     s;Monday;Mon\&shy\;tag;g;           s;Mon\.;Mo.;g;
140     s;Tuesday;Diens\&shy\;tag;g;        s;Tue\.;Di.;g;
141     s;Wednesday;Mitt\&shy\;woch;g;      s;Wed\.;Mi.;g;
142     s;Thursday;Don\&shy\;ners\&shy\;tag;g; s;Thu\.;Do.;g;
143     s;Friday;Frei\&shy\;tag;g;          s;Fri\.;Fr.;g;
144     s;Saturday;Sams\&shy\;tag;g;        s;Sat\.;Sa.;g;
145     s;Sunday;Sonn\&shy\;tag;g;          s;Sun\.;So.;g;
146
147     s;January;Ja\&shy\;nu\&shy\;ar;g;           s;Jan\.;Jan.;g;
148     s;February;Fe\&shy\;bru\&shy\;ar;g;         s;Feb\.;Feb.;g;
149     s;March;März;g;                            s;Mar\.;Mär.;g;
150     s;April;April;g;                            s;Apr\.;Apr.;g;
151     s;May;Mai;g;                                s;May\.;Mai.;g;
152     s;June;Juni;g;                              s;Jun\.;Jun.;g;
153     s;July;Juli;g;                              s;Jul\.;Jul.;g;
154     s;August;Au\&shy\;gust;g;                   s;Aug\.;Aug.;g;
155     s;September;Sep\&shy\;tem\&shy\;ber;g;      s;Sep\.;Sep.;g;
156     s;October;Ok\&shy\;to\&shy\;ber;g;          s;Oct\.;Okt.;g;
157     s;November;No\&shy\;vem\&shy\;ber;g;        s;Nov\.;Nov.;g;
158     s;December;De\&shy\;zem\&shy\;ber;g;        s;Dec\.;Dez.;g;
159   '
160 }
161
162 parse_date() {
163   [ $# -eq 0 ] && read -r date || date="$*"
164
165   case $date in
166     *[0-9].*[0-9].*[0-9])
167       d="${date%%.*}"
168       y="${date##*.}"
169       m="${date%.*}"
170       m="${m#*.}"
171       [ $y -lt 100 ] && y="$((y + 2000))"
172       date -d "$(printf '%04i-%02i-%02i' "$y" "$m" "$d")" +%F
173       ;;
174     *) date -d "$date" +%F
175       ;;
176   esac
177 }