Ejemplo n.º 1
0
    def test_easy_gettext_setup_non_unicode(self):
        '''Test that the easy_gettext_setup function works
        '''
        b_, bN_ = i18n.easy_gettext_setup('foo', localedirs=
                ['%s/data/locale/' % os.path.dirname(__file__)],
                use_unicode=False)

        tools.eq_(b_(self.utf8_spanish), self.utf8_spanish)
        tools.eq_(b_(self.u_spanish), self.latin1_spanish)
        tools.eq_(bN_(self.utf8_limao, self.utf8_limoes, 1), self.utf8_limao)
        tools.eq_(bN_(self.utf8_limao, self.utf8_limoes, 2), self.utf8_limoes)
        tools.eq_(bN_(self.u_limao, self.u_limoes, 1), self.latin1_limao)
        tools.eq_(bN_(self.u_limao, self.u_limoes, 2), self.latin1_limoes)
Ejemplo n.º 2
0
    def test_easy_gettext_setup_non_unicode(self):
        '''Test that the easy_gettext_setup function works
        '''
        b_, bN_ = i18n.easy_gettext_setup('foo', localedirs=
                ['%s/data/locale/' % os.path.dirname(__file__)],
                use_unicode=False)

        tools.ok_(b_('café') == 'café')
        tools.ok_(b_(u'café') == 'caf\xe9')
        tools.ok_(bN_('café', 'cafés', 1) == 'café')
        tools.ok_(bN_('café', 'cafés', 2) == 'cafés')
        tools.ok_(bN_(u'café', u'cafés', 1) == 'caf\xe9')
        tools.ok_(bN_(u'café', u'cafés', 2) == 'caf\xe9s')
Ejemplo n.º 3
0
    def test_easy_gettext_setup_non_unicode(self):
        '''Test that the easy_gettext_setup function works
        '''
        b_, bN_ = i18n.easy_gettext_setup(
            'foo',
            localedirs=['%s/data/locale/' % os.path.dirname(__file__)],
            use_unicode=False)

        tools.eq_(b_(self.utf8_spanish), self.utf8_spanish)
        tools.eq_(b_(self.u_spanish), self.latin1_spanish)
        tools.eq_(bN_(self.utf8_limao, self.utf8_limoes, 1), self.utf8_limao)
        tools.eq_(bN_(self.utf8_limao, self.utf8_limoes, 2), self.utf8_limoes)
        tools.eq_(bN_(self.u_limao, self.u_limoes, 1), self.latin1_limao)
        tools.eq_(bN_(self.u_limao, self.u_limoes, 2), self.latin1_limoes)
Ejemplo n.º 4
0
    def test_easy_gettext_setup(self):
        '''Test that the easy_gettext_setup function works
        '''
        _, N_ = i18n.easy_gettext_setup(
            'foo', localedirs=['%s/data/locale/' % os.path.dirname(__file__)])
        tools.assert_true(isinstance(_, types.MethodType))
        tools.assert_true(isinstance(N_, types.MethodType))
        tools.eq_(_.__name__, '_ugettext')
        tools.eq_(N_.__name__, '_ungettext')

        tools.eq_(_(self.utf8_spanish), self.u_spanish)
        tools.eq_(_(self.u_spanish), self.u_spanish)
        tools.eq_(N_(self.utf8_limao, self.utf8_limoes, 1), self.u_limao)
        tools.eq_(N_(self.utf8_limao, self.utf8_limoes, 2), self.u_limoes)
        tools.eq_(N_(self.u_limao, self.u_limoes, 1), self.u_limao)
        tools.eq_(N_(self.u_limao, self.u_limoes, 2), self.u_limoes)
Ejemplo n.º 5
0
    def test_easy_gettext_setup(self):
        '''Test that the easy_gettext_setup function works
        '''
        _, N_ = i18n.easy_gettext_setup('foo', localedirs=
                ['%s/data/locale/' % os.path.dirname(__file__)])
        tools.ok_(isinstance(_, types.MethodType))
        tools.ok_(isinstance(N_, types.MethodType))
        tools.ok_(_.im_func.func_name == 'ugettext')
        tools.ok_(N_.im_func.func_name == 'ungettext')

        tools.ok_(_('café') == u'café')
        tools.ok_(_(u'café') == u'café')
        tools.ok_(N_('café', 'cafés', 1) == u'café')
        tools.ok_(N_('café', 'cafés', 2) == u'cafés')
        tools.ok_(N_(u'café', u'cafés', 1) == u'café')
        tools.ok_(N_(u'café', u'cafés', 2) == u'cafés')
Ejemplo n.º 6
0
    def test_easy_gettext_setup(self):
        '''Test that the easy_gettext_setup function works
        '''
        _, N_ = i18n.easy_gettext_setup('foo', localedirs=
                ['%s/data/locale/' % os.path.dirname(__file__)])
        tools.assert_true(isinstance(_, types.MethodType))
        tools.assert_true(isinstance(N_, types.MethodType))
        tools.eq_(_.__name__, '_ugettext')
        tools.eq_(N_.__name__, '_ungettext')

        tools.eq_(_(self.utf8_spanish), self.u_spanish)
        tools.eq_(_(self.u_spanish), self.u_spanish)
        tools.eq_(N_(self.utf8_limao, self.utf8_limoes, 1), self.u_limao)
        tools.eq_(N_(self.utf8_limao, self.utf8_limoes, 2), self.u_limoes)
        tools.eq_(N_(self.u_limao, self.u_limoes, 1), self.u_limao)
        tools.eq_(N_(self.u_limao, self.u_limoes, 2), self.u_limoes)
Ejemplo n.º 7
0
    def test_easy_gettext_setup_non_unicode(self):
        '''Test that the easy_gettext_setup function works
        '''
        b_, bN_ = i18n.easy_gettext_setup('foo', localedirs=
                ['%s/data/locale/' % os.path.dirname(__file__)],
                use_unicode=False)
        tools.ok_(isinstance(b_, types.MethodType))
        tools.ok_(isinstance(bN_, types.MethodType))
        tools.ok_(b_.im_func.func_name == 'lgettext')
        tools.ok_(bN_.im_func.func_name == 'lngettext')

        tools.ok_(b_('café') == 'café')
        tools.ok_(b_(u'café') == 'café')
        tools.ok_(bN_('café', 'cafés', 1) == 'café')
        tools.ok_(bN_('café', 'cafés', 2) == 'cafés')
        tools.ok_(bN_(u'café', u'cafés', 1) == 'café')
        tools.ok_(bN_(u'café', u'cafés', 2) == 'cafés')
Ejemplo n.º 8
0
    def test_easy_gettext_setup_non_unicode(self):
        '''Test that the easy_gettext_setup function works
        '''
        b_, bN_ = i18n.easy_gettext_setup('foo', localedirs=
                ['%s/data/locale/' % os.path.dirname(__file__)],
                use_unicode=False)
        tools.assert_true(isinstance(b_, types.MethodType))
        tools.assert_true(isinstance(bN_, types.MethodType))
        tools.eq_(b_.__name__, '_lgettext')
        tools.eq_(bN_.__name__, '_lngettext')

        tools.eq_(b_(self.utf8_spanish), self.utf8_spanish)
        tools.eq_(b_(self.u_spanish), self.utf8_spanish)
        tools.eq_(bN_(self.utf8_limao, self.utf8_limoes, 1), self.utf8_limao)
        tools.eq_(bN_(self.utf8_limao, self.utf8_limoes, 2), self.utf8_limoes)
        tools.eq_(bN_(self.u_limao, self.u_limoes, 1), self.utf8_limao)
        tools.eq_(bN_(self.u_limao, self.u_limoes, 2), self.utf8_limoes)
Ejemplo n.º 9
0
    def test_easy_gettext_setup_non_unicode(self):
        '''Test that the easy_gettext_setup function works
        '''
        b_, bN_ = i18n.easy_gettext_setup(
            'foo',
            localedirs=['%s/data/locale/' % os.path.dirname(__file__)],
            use_unicode=False)
        tools.assert_true(isinstance(b_, types.MethodType))
        tools.assert_true(isinstance(bN_, types.MethodType))
        tools.eq_(b_.__name__, '_lgettext')
        tools.eq_(bN_.__name__, '_lngettext')

        tools.eq_(b_(self.utf8_spanish), self.utf8_spanish)
        tools.eq_(b_(self.u_spanish), self.utf8_spanish)
        tools.eq_(bN_(self.utf8_limao, self.utf8_limoes, 1), self.utf8_limao)
        tools.eq_(bN_(self.utf8_limao, self.utf8_limoes, 2), self.utf8_limoes)
        tools.eq_(bN_(self.u_limao, self.u_limoes, 1), self.utf8_limao)
        tools.eq_(bN_(self.u_limao, self.u_limoes, 2), self.utf8_limoes)
Ejemplo n.º 10
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
# 
# You should have received a copy of the GNU Lesser General Public
# License along with kitchen; if not, see <http://www.gnu.org/licenses/>
#
# Authors:
#   Toshio Kuratomi <*****@*****.**>
#
'''
Kitchen

Aggregate of a bunch of unrelated but helpful python modules.
'''

# Pylint disabled messages:
# :C0103: We need gettext aliases for both unicode strings and byte strings.
#   The byte string one (b_) triggers this warning.
from kitchen import i18n
from kitchen import versioning

(_, N_) = i18n.easy_gettext_setup('kitchen.core')
#pylint: disable-msg=C0103
(b_, bN_) = i18n.easy_gettext_setup('kitchen.core', use_unicode=False)
#pylint: enable-msg=C0103

__version_info__ = ((1, 2, 0), ('a', 1))
__version__ = versioning.version_tuple_to_string(__version_info__)

__all__ = ('exceptions', 'release',)
Ejemplo n.º 11
0
# You should have received a copy of the GNU Lesser General Public
# License along with kitchen; if not, see <http://www.gnu.org/licenses/>
#
# Authors:
#   Toshio Kuratomi <*****@*****.**>
#
'''
Kitchen

Aggregate of a bunch of unrelated but helpful python modules.
'''

# Pylint disabled messages:
# :C0103: We need gettext aliases for both unicode strings and byte strings.
#   The byte string one (b_) triggers this warning.
from kitchen import i18n
from kitchen import versioning

(_, N_) = i18n.easy_gettext_setup('kitchen.core')
#pylint: disable-msg=C0103
(b_, bN_) = i18n.easy_gettext_setup('kitchen.core', use_unicode=False)
#pylint: enable-msg=C0103

__version_info__ = ((1, 2, 6), )
__version__ = versioning.version_tuple_to_string(__version_info__)

__all__ = (
    'exceptions',
    'release',
)
Ejemplo n.º 12
0
    
def dummy_wrapper(str):
    '''
    Dummy Translation wrapper, just returning the same string.
    '''
    return str

def dummyP_wrapper(str1, str2, n):
    '''
    Dummy Plural Translation wrapper, just returning the singular or plural
    string.
    '''
    if n == 1:
        return str1
    else:
        return str2

if _use_i18n:
    try:
        from kitchen.i18n import easy_gettext_setup
        # setup the translation wrappers
        _, P_  = easy_gettext_setup('yum-utils') 
    except:
        _ = dummy_wrapper
        P_ = dummyP_wrapper
else:
    _ = dummy_wrapper
    P_ = dummyP_wrapper
    
Ejemplo n.º 13
0
# version 2.1 of the License, or (at your option) any later version.
#
# kitchen is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with kitchen; if not, see <http://www.gnu.org/licenses/>
#
# Authors:
#   Toshio Kuratomi <*****@*****.**>
#
'''
Kitchen

Aggregate of a bunch of unrelated but helpful python modules.
'''
from kitchen import i18n
from kitchen import versioning

(_, P_) = i18n.easy_gettext_setup('kitchen.core')

__version_info__ = ((0, 2, 1), ('a', 1))
__version__ = versioning.version_tuple_to_string(__version_info__)

__all__ = (
    'exceptions',
    'release',
)
Ejemplo n.º 14
0
def dummy_wrapper(str):
    '''
    Dummy Translation wrapper, just returning the same string.
    '''
    return str


def dummyP_wrapper(str1, str2, n):
    '''
    Dummy Plural Translation wrapper, just returning the singular or plural
    string.
    '''
    if n == 1:
        return str1
    else:
        return str2


if _use_i18n:
    try:
        from kitchen.i18n import easy_gettext_setup
        # setup the translation wrappers
        _, P_ = easy_gettext_setup('yum-utils')
    except:
        _ = dummy_wrapper
        P_ = dummyP_wrapper
else:
    _ = dummy_wrapper
    P_ = dummyP_wrapper
Ejemplo n.º 15
0
'''
Yumex Backend Base Classes
'''

import time
import sys
import os.path

from kitchen.i18n import easy_gettext_setup

# setup the translation wrappers

#_, P_  = easy_gettext_setup('yumex')

_, P_  = easy_gettext_setup('yumex', localedirs=[os.path.join(sys.prefix, 'share', 'locale')])

class YumexProgressBase:
    '''
    A Virtual Progress class
    '''
    def __init__(self):
        '''

        '''
        self._active = False
        self._pulse = False

    def show(self):
        ''' Show the progress '''
        self._active = True