'Test django translation service works fine.'

def test_django_service_translation_works(self):

    class wrap_ugettext_with_xyz(object, ):
        "\n                                                A    context    manager    function    that    just    adds    'XYZ    '    to    the    front\n                                                of    all    strings    of    the    module    ugettext    function.\n                                                "
        def __init__(self, module):
            self.module = module
            self.old_ugettext = module.ugettext
        def __enter__(self):
            def new_ugettext(*args, **kwargs):
                '    custom    function    '
                output = self.old_ugettext(*args, **kwargs)
                return ('XYZ    ' + output)
            self.module.ugettext = new_ugettext
        def __exit__(self, _type, _value, _traceback):
            self.module.ugettext = self.old_ugettext
    i18n_service = self.get_module_i18n_service(self.descriptor)
    with translation.override('fr'):
        french_translation = translation.trans_real._active.value
        with wrap_ugettext_with_xyz(french_translation):
            self.assertEqual(i18n_service.ugettext(self.test_language), 'XYZ    dummy    language')
        self.assertEqual(i18n_service.ugettext(self.test_language), 'dummy    language')
