1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 ''' Useful tools related to internationalization issues. '''
23
24
26
27 """ Select a translation among a set of possible values """
28
30 import locale
31
32 lang, charset = locale.getlocale ()
33
34 self.lang = lang or ''
35 self.lang_one = self.lang.split ('_') [0]
36
37 return
38
39 - def trn (self, table):
40
41 if table.has_key (self.lang):
42 return table [self.lang]
43
44 if table.has_key (self.lang_one):
45 return table [self.lang_one]
46
47 if table.has_key (''):
48 return table ['']
49
50 return table ['C']
51
52 lz = Localize ()
53