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