Show More
@@ -36,15 +36,16 b' def gettext(message):' | |||
|
36 | 36 | if message is None: |
|
37 | 37 | return message |
|
38 | 38 | |
|
39 | u = t.ugettext(message) | |
|
39 | 40 | try: |
|
40 | 41 | # encoding.tolocal cannot be used since it will first try to |
|
41 | 42 | # decode the Unicode string. Calling u.decode(enc) really |
|
42 | 43 | # means u.encode(sys.getdefaultencoding()).decode(enc). Since |
|
43 | 44 | # the Python encoding defaults to 'ascii', this fails if the |
|
44 | 45 | # translated string use non-ASCII characters. |
|
45 | u = t.ugettext(message) | |
|
46 | 46 | return u.encode(encoding.encoding, "replace") |
|
47 | 47 | except LookupError: |
|
48 | # An unknown encoding results in a LookupError. | |
|
48 | 49 | return message |
|
49 | 50 | |
|
50 | 51 | _ = gettext |
General Comments 0
You need to be logged in to leave comments.
Login now