1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """
24 Class handling language-specific selection for date parser and displayer.
25 """
26
27
28 from _DateHandler import (LANG, LANG_SHORT, LANG_TO_PARSER, LANG_TO_DISPLAY,
29 register_datehandler)
30
31
32 import _Date_cs
33 import _Date_de
34 import _Date_es
35 import _Date_fi
36 import _Date_fr
37 import _Date_lt
38 import _Date_nb
39 import _Date_nl
40 import _Date_pl
41 import _Date_pt
42 import _Date_ru
43 import _Date_sk
44 import _Date_sv
45
46
47 try:
48 if LANG_TO_PARSER.has_key(LANG):
49 parser = LANG_TO_PARSER[LANG]()
50 else:
51 parser = LANG_TO_PARSER[LANG_SHORT]()
52 except:
53 print "Date parser for", LANG, "not available, using default"
54 parser = LANG_TO_PARSER["C"]()
55
56
57 try:
58 import Config
59 val = Config.get_date_format(LANG_TO_DISPLAY[LANG].formats)
60 except:
61 try:
62 val = Config.get_date_format(LANG_TO_DISPLAY["C"].formats)
63 except:
64 val = 0
65
66 try:
67 if LANG_TO_DISPLAY.has_key(LANG):
68 displayer = LANG_TO_DISPLAY[LANG](val)
69 else:
70 displayer = LANG_TO_DISPLAY[LANG_SHORT](val)
71 except:
72 print "Date displayer for", LANG, "not available, using default"
73 displayer = LANG_TO_DISPLAY["C"](val)
74
75
76
77 from _DateUtils import *
78