Changeset View
Changeset View
Standalone View
Standalone View
gcompris.py
1 | #!/usr/bin/python2 | 1 | #!/usr/bin/python3 | ||
---|---|---|---|---|---|
2 | # -*- coding: utf-8 -*- | 2 | # -*- coding: utf-8 -*- | ||
3 | 3 | | |||
4 | import codecs | 4 | import codecs | ||
Context not available. | |||||
9 | import datetime | 9 | import datetime | ||
10 | from datetime import date | 10 | from datetime import date | ||
11 | import re | 11 | import re | ||
12 | from collections import OrderedDict | | |||
13 | import gettext | 12 | import gettext | ||
14 | from email import utils | 13 | from email import utils | ||
14 | from importlib import reload | ||||
15 | 15 | | |||
16 | reload(sys) | 16 | reload(sys) | ||
17 | sys.setdefaultencoding('utf-8') | | |||
18 | 17 | | |||
19 | today = date.today() | 18 | today = date.today() | ||
20 | 19 | | |||
21 | try: | 20 | try: | ||
22 | version = sys.argv[1] | 21 | version = sys.argv[1] | ||
23 | except: | 22 | except: | ||
24 | print "Missing GCompris version" | 23 | print("Missing GCompris version") | ||
25 | sys.exit(1) | 24 | sys.exit(1) | ||
26 | 25 | | |||
27 | try: | 26 | try: | ||
28 | locale = sys.argv[2] | 27 | locale = sys.argv[2] | ||
29 | except: | 28 | except: | ||
30 | print "Missing GCompris locale" | 29 | print("Missing GCompris locale") | ||
31 | sys.exit(1) | 30 | sys.exit(1) | ||
32 | 31 | | |||
33 | try: | 32 | try: | ||
34 | localelist = sys.argv[3] | 33 | localelist = sys.argv[3] | ||
35 | except: | 34 | except: | ||
36 | print "Missing GCompris list of locales" | 35 | print("Missing GCompris list of locales") | ||
37 | sys.exit(1) | 36 | sys.exit(1) | ||
38 | 37 | | |||
39 | try: | 38 | try: | ||
40 | gcomprisdir = sys.argv[4] | 39 | gcomprisdir = sys.argv[4] | ||
41 | except: | 40 | except: | ||
42 | print "Missing GCompris installation directory, export GCOMPRIS_DIR as env var" | 41 | print("Missing GCompris installation directory, export GCOMPRIS_DIR as env var") | ||
43 | sys.exit(1) | 42 | sys.exit(1) | ||
44 | 43 | | |||
45 | # Load the proper locale catalog | 44 | # Load the proper locale catalog | ||
Context not available. | |||||
52 | t = gettext.translation('gcompris', 'locale', languages=[locale]) | 51 | t = gettext.translation('gcompris', 'locale', languages=[locale]) | ||
53 | except: | 52 | except: | ||
54 | t = gettext.NullTranslations() | 53 | t = gettext.NullTranslations() | ||
55 | _ = t.ugettext | 54 | _ = t.gettext | ||
56 | 55 | | |||
57 | def formatDate(date): | 56 | def formatDate(date): | ||
58 | return date[0:4] + '-' + date[4:6] + '-' + date[6:8] | 57 | return date[0:4] + '-' + date[4:6] + '-' + date[6:8] | ||
Context not available. | |||||
269 | extensions=['jinja2.ext.i18n'], | 268 | extensions=['jinja2.ext.i18n'], | ||
270 | trim_blocks=True, | 269 | trim_blocks=True, | ||
271 | lstrip_blocks=True) | 270 | lstrip_blocks=True) | ||
272 | templateEnv.install_gettext_callables(t.ugettext, t.ungettext, newstyle=True) | 271 | templateEnv.install_gettext_callables(t.gettext, t.ngettext, newstyle=True) | ||
273 | 272 | | |||
274 | # Specify any input variables to the template as a dictionary. | 273 | # Specify any input variables to the template as a dictionary. | ||
275 | templateVars = { | 274 | templateVars = { | ||
Context not available. |