cwgettext.py
author Rémi Cardona <remi.cardona@logilab.fr>
Mon, 21 Sep 2015 17:51:58 +0200
changeset 10720 201028085e12
parent 10719 065b5ac5c039
permissions -rw-r--r--
[migration] NoneType is no longer comparable in py3k
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    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
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    20
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    21
10719
065b5ac5c039 Rename gettext to cwgettext, use stdlib gettext
Rémi Cardona <remi.cardona@logilab.fr>
parents: 10590
diff changeset
    22
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
    23
    # 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
    24
    # 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
    25
    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
    26
7d53d8491932 gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
    27
    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
    28
        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
    29
        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
    30
        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
    31
        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
    32
            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
    33
                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
    34
            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
    35
        # 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
    36
        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
    37
            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
    38
        elif self._charset:
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    39
            return tmsg.encode(self._charset)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    40
        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
    41
3274
7d53d8491932 gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
    42
    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
    43
        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
    44
        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
    45
        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
    46
        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
    47
            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
    48
                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
    49
            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
    50
        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
    51
            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
    52
        return tmsg.encode(locale.getpreferredencoding())
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    53
3274
7d53d8491932 gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
    54
    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
    55
        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
    56
        try:
7d53d8491932 gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
    57
            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
    58
            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
    59
                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
    60
            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
    61
                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
    62
            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
    63
        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
    64
            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
    65
                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
    66
            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
    67
                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
    68
            else:
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 msgid2        
7d53d8491932 gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
    70
7d53d8491932 gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
    71
    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
    72
        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
    73
        try:
7d53d8491932 gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
    74
            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
    75
            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
    76
                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
    77
            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
    78
        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
    79
            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
    80
                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
    81
            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
    82
                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
    83
            else:
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 msgid2
7d53d8491932 gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
    85
7d53d8491932 gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
    86
    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
    87
        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
    88
        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
    89
        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
    90
        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
    91
            # 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
    92
            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
    93
            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
    94
                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
    95
            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
    96
        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
    97
7d53d8491932 gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
    98
    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
    99
        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
   100
        try:
7d53d8491932 gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   101
            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
   102
        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
   103
            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
   104
                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
   105
            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
   106
                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
   107
            else:
7d53d8491932 gettext] provide a more up-to-date version of gettext.py
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   108
                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
   109
        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
   110
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   111
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   112
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
   113
                class_=None, fallback=False, codeset=None):
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   114
    if class_ is None:
10719
065b5ac5c039 Rename gettext to cwgettext, use stdlib gettext
Rémi Cardona <remi.cardona@logilab.fr>
parents: 10590
diff changeset
   115
        class_ = cwGNUTranslations
065b5ac5c039 Rename gettext to cwgettext, use stdlib gettext
Rémi Cardona <remi.cardona@logilab.fr>
parents: 10590
diff changeset
   116
    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
   117
                               languages=languages, class_=class_,
065b5ac5c039 Rename gettext to cwgettext, use stdlib gettext
Rémi Cardona <remi.cardona@logilab.fr>
parents: 10590
diff changeset
   118
                               fallback=fallback, codeset=codeset)