author | Laurent Wouters <lwouters@cenotelie.fr> |
Tue, 24 Apr 2018 11:22:17 +0200 | |
changeset 12303 | 198cb7d7b4ac |
parent 11823 | 4f43e64603ef |
child 12567 | 26744ad37953 |
permissions | -rw-r--r-- |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
1 |
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
3 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
4 |
# This file is part of CubicWeb. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
5 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
9 |
# any later version. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
10 |
# |
5424
8ecbcbff9777
replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5421
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
14 |
# details. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
15 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3279
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
0 | 18 |
|
10719
065b5ac5c039
Rename gettext to cwgettext, use stdlib gettext
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10590
diff
changeset
|
19 |
import gettext |
0 | 20 |
|
11823
4f43e64603ef
Alias ugettext to gettext method of cwGNUTranslations in Python 3
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
11057
diff
changeset
|
21 |
from six import PY3 |
4f43e64603ef
Alias ugettext to gettext method of cwGNUTranslations in Python 3
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
11057
diff
changeset
|
22 |
|
0 | 23 |
|
10719
065b5ac5c039
Rename gettext to cwgettext, use stdlib gettext
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10590
diff
changeset
|
24 |
class cwGNUTranslations(gettext.GNUTranslations): |
3274
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
25 |
# The encoding of a msgctxt and a msgid in a .mo file is |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
26 |
# msgctxt + "\x04" + msgid (gettext version >= 0.15) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
27 |
CONTEXT_ENCODING = "%s\x04%s" |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
28 |
|
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
29 |
def pgettext(self, context, message): |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
30 |
ctxt_msg_id = self.CONTEXT_ENCODING % (context, message) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
31 |
missing = object() |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
32 |
tmsg = self._catalog.get(ctxt_msg_id, missing) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
33 |
if tmsg is missing: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
34 |
if self._fallback: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
35 |
return self._fallback.pgettext(context, message) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
36 |
return message |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
37 |
# Encode the Unicode tmsg back to an 8-bit string, if possible |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
38 |
if self._output_charset: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
39 |
return tmsg.encode(self._output_charset) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
40 |
elif self._charset: |
0 | 41 |
return tmsg.encode(self._charset) |
42 |
return tmsg |
|
3279
6a2cde3f886e
patch gettext for compat w/ catalog generated by cw < 3.5
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3274
diff
changeset
|
43 |
|
3274
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
44 |
def lpgettext(self, context, message): |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
45 |
ctxt_msg_id = self.CONTEXT_ENCODING % (context, message) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
46 |
missing = object() |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
47 |
tmsg = self._catalog.get(ctxt_msg_id, missing) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
48 |
if tmsg is missing: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
49 |
if self._fallback: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
50 |
return self._fallback.lpgettext(context, message) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
51 |
return message |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
52 |
if self._output_charset: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
53 |
return tmsg.encode(self._output_charset) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
54 |
return tmsg.encode(locale.getpreferredencoding()) |
0 | 55 |
|
3274
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
56 |
def npgettext(self, context, msgid1, msgid2, n): |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
57 |
ctxt_msg_id = self.CONTEXT_ENCODING % (context, msgid1) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
58 |
try: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
59 |
tmsg = self._catalog[(ctxt_msg_id, self.plural(n))] |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
60 |
if self._output_charset: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
61 |
return tmsg.encode(self._output_charset) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
62 |
elif self._charset: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
63 |
return tmsg.encode(self._charset) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
64 |
return tmsg |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
65 |
except KeyError: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
66 |
if self._fallback: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
67 |
return self._fallback.npgettext(context, msgid1, msgid2, n) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
68 |
if n == 1: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
69 |
return msgid1 |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
70 |
else: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
71 |
return msgid2 |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
72 |
|
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
73 |
def lnpgettext(self, context, msgid1, msgid2, n): |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
74 |
ctxt_msg_id = self.CONTEXT_ENCODING % (context, msgid1) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
75 |
try: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
76 |
tmsg = self._catalog[(ctxt_msg_id, self.plural(n))] |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
77 |
if self._output_charset: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
78 |
return tmsg.encode(self._output_charset) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
79 |
return tmsg.encode(locale.getpreferredencoding()) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
80 |
except KeyError: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
81 |
if self._fallback: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
82 |
return self._fallback.lnpgettext(context, msgid1, msgid2, n) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
83 |
if n == 1: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
84 |
return msgid1 |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
85 |
else: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
86 |
return msgid2 |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
87 |
|
11823
4f43e64603ef
Alias ugettext to gettext method of cwGNUTranslations in Python 3
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
11057
diff
changeset
|
88 |
if PY3: |
4f43e64603ef
Alias ugettext to gettext method of cwGNUTranslations in Python 3
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
11057
diff
changeset
|
89 |
ugettext = gettext.GNUTranslations.gettext |
4f43e64603ef
Alias ugettext to gettext method of cwGNUTranslations in Python 3
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
11057
diff
changeset
|
90 |
|
3274
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
91 |
def upgettext(self, context, message): |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
92 |
ctxt_message_id = self.CONTEXT_ENCODING % (context, message) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
93 |
missing = object() |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
94 |
tmsg = self._catalog.get(ctxt_message_id, missing) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
95 |
if tmsg is missing: |
3279
6a2cde3f886e
patch gettext for compat w/ catalog generated by cw < 3.5
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3274
diff
changeset
|
96 |
# XXX logilab patch for compat w/ catalog generated by cw < 3.5 |
6a2cde3f886e
patch gettext for compat w/ catalog generated by cw < 3.5
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3274
diff
changeset
|
97 |
return self.ugettext(message) |
3274
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
98 |
if self._fallback: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
99 |
return self._fallback.upgettext(context, message) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
100 |
return unicode(message) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
101 |
return tmsg |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
102 |
|
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
103 |
def unpgettext(self, context, msgid1, msgid2, n): |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
104 |
ctxt_message_id = self.CONTEXT_ENCODING % (context, msgid1) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
105 |
try: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
106 |
tmsg = self._catalog[(ctxt_message_id, self.plural(n))] |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
107 |
except KeyError: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
108 |
if self._fallback: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
109 |
return self._fallback.unpgettext(context, msgid1, msgid2, n) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
110 |
if n == 1: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
111 |
tmsg = unicode(msgid1) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
112 |
else: |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
113 |
tmsg = unicode(msgid2) |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
114 |
return tmsg |
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
115 |
|
0 | 116 |
|
117 |
def translation(domain, localedir=None, languages=None, |
|
3274
7d53d8491932
gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
118 |
class_=None, fallback=False, codeset=None): |
0 | 119 |
if class_ is None: |
10719
065b5ac5c039
Rename gettext to cwgettext, use stdlib gettext
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10590
diff
changeset
|
120 |
class_ = cwGNUTranslations |
065b5ac5c039
Rename gettext to cwgettext, use stdlib gettext
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10590
diff
changeset
|
121 |
return gettext.translation(domain, localedir=localedir, |
065b5ac5c039
Rename gettext to cwgettext, use stdlib gettext
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10590
diff
changeset
|
122 |
languages=languages, class_=class_, |
065b5ac5c039
Rename gettext to cwgettext, use stdlib gettext
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10590
diff
changeset
|
123 |
fallback=fallback, codeset=codeset) |