forked from RaspberryPiFoundation/jam-photobooth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
text.py
84 lines (77 loc) · 2.7 KB
/
text.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# English
text_en = {
'tweet': "Excited about #CoolestProjects",
'photo number': "Photo {} of {}",
'press to capture': "Press the button to capture...",
'tweeting': "Tweeting...",
'tweeted': "Tweeted!",
'tweeting with cancel': "Tweeting...\n" "Press the button to cancel",
'ready': "Ready!\n" "Press the button to start...",
'failed tweet': "Failed to tweet :(",
'not tweeting': "Not tweeting",
}
# German - Deutsche
text_de = {
'tweet': "#PiParty Fotoautomat",
'photo number': "Foto {} von {}",
'press to capture': "Drucke den Knopf fur ein Foto...",
'tweeting': "Am Twittern...",
'tweeted': "Getwittert!",
'tweeting with cancel': "Am Twittern...\n" "Drucke den Knopf um abzubrechen",
'ready': "Bereit!\n" "Drucke den Knopf um zu starten...",
'failed tweet': "Fehler beim Twittern :(",
'not tweeting': "Nicht am Twittern",
}
# French - Français
text_fr = {
'tweet': "Photomaton #PiParty",
'photo number': "Photo {} de {}",
'press to capture': "Appuyez sur le bouton pour capturer...",
'tweeting': "Tweetant...",
'tweeted': "Tweete!",
'tweeting with cancel': "Tweetant...\n" "Appuyez sur le bouton pour annuler",
'ready': "Pret!\n" "Appuyez sur le bouton pour commencer...",
'failed tweet': "Echec du tweet :(",
'not tweeting': "Non tweetant",
}
# Spanish - Español
text_es = {
'tweet': "#PiParty cabina de fotos",
'photo number': "Foto {} de {}",
'press to capture': "Presione el boton para sacar fotos...",
'tweeting': "Tuiteando...",
'tweeted': "Tuit enviado!",
'tweeting with cancel': "Tuiteando...\n" "Presione el boton para cancelar",
'ready': "Listo!\n" "Presione el boton para comenzar...",
'failed tweet': "Error al tuitear :(",
'not tweeting': "Tuit cancelado",
}
# Welsh - Cymraeg
text_cy = {
'tweet': "#PiParty bwth lluniau",
'photo number': "Llun {} o {}",
'press to capture': "Gwasgwch y botwm i'w dal...",
'tweeting': "Tweetio...",
'tweeted': "Tweetio!",
'tweeting with cancel': "Tweetio...\n" "Gwasgwch y botwm i ganslo",
'ready': "Barod!\n" "Gwasgwch y botwm i ddechrau...",
'failed tweet': "Methwyd tweet :(",
'not tweeting': "Ddim yn tweetio",
}
language_dicts = {
'en': text_en,
'de': text_de,
'fr': text_fr,
'es': text_es,
'cy': text_cy,
}
def get_text(language='en'):
"""
Retrieve a dictionary of text in the specified language, if available
"""
return language_dicts[language]
# test for non-ascii characters not supported by the camera firmware
for language in language_dicts.values():
for key, text in language.items():
if key != 'tweet':
assert all(ord(c) in range(128) for c in text), text