-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_info.py
52 lines (43 loc) · 1.15 KB
/
generate_info.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
from itertools import starmap
GROUPINGS = ('theorie', 'exercice', 'pygame',
'progra', 'gl', 'lecture', 'pdf',
'projet', 'colorpicker', '')
EXTS = {
'.pdf': 1,
'.odp': 2,
'.html': 3,
'.css': 4,
'.svg': 5,
'.png': 6,
'.jpg': 7,
'.py': 8,
'.php': 9,
'.java': 10,
'.js': 11,
}
def auto_lang_dict(basename, ext, sep=None):
if sep is None:
sep = '_' if ext == 'py' else '.'
return {
basename + sep + 'multilang' + '.' + ext: {
lang: basename + sep + lang + '.' + ext
for lang in ('fr', 'en')
}
}
def auto_lang_dict_aggreg(*it):
return {k:v for d in starmap(auto_lang_dict, it) for k,v in d.items()}
TRANSLATION_INFO = {
# 'example_base_file.ext': {
# 'fr': 'example_french_version.ext',
# 'en': 'example_english_version.ext',
# },
'projets.multilang_as_projects.html': {
'fr': 'projet.html',
'en': 'projects.html',
},
}
TRANSLATION_INFO.update(auto_lang_dict_aggreg(
('theorie1_egal_if', 'py'),
('progra_equivalences', 'py'),
('progra_equivalences', 'html', '_'),
))