Example #1
0
    def test_31_override_settings(self):
        """Testing settings override."""
        def override_settings():
            return get_setting('LANGUAGE_DETECTION_MAX_NUM_KEYWORDS')

        self.assertEqual(defaults.LANGUAGE_DETECTION_MAX_NUM_KEYWORDS,
                         override_settings())

        set_setting('LANGUAGE_DETECTION_MAX_NUM_KEYWORDS', 10)

        self.assertEqual(10, override_settings())

        return override_settings()
Example #2
0
    def test_31_override_settings(self):
        """
        Testing settings override.
        """
        def override_settings():
            return get_setting('LANGUAGE_DETECTION_MAX_NUM_KEYWORDS')

        self.assertEqual(defaults.LANGUAGE_DETECTION_MAX_NUM_KEYWORDS, override_settings())

        set_setting('LANGUAGE_DETECTION_MAX_NUM_KEYWORDS', 10)

        self.assertEqual(10, override_settings())

        return override_settings()
Example #3
0
# -*- coding: utf-8 -*-

from transliterate.discover import autodiscover
from transliterate.conf import set_setting
from transliterate import get_available_language_codes, translit

set_setting('DEBUG', True)

# Autodiscover available language packs
#autodiscover()

print '\nOriginal text\n---------------------------------------'
text = "Lorem ipsum dolor sit amet"
print text

print '\nTransliteration to Armenian\n---------------------------------------'
print translit(text, 'hy')

print '\nTransliteration to Russian\n---------------------------------------'
print translit(text, 'ru')

print '\nList of available (registered) languages\n---------------------------------------'
print get_available_language_codes()

print '\nReversed transliteration from Armenian\n---------------------------------------'
print translit(u'Լօրեմ իպսում դoլoր սիտ ամետ', 'hy', reversed=True)

print '\nReversed transliteration from Russian\n---------------------------------------'
print translit(u'Лорем ипсум долор сит амет', 'ru', reversed=True)

print '\nTesting the function decorator\n---------------------------------------'
Example #4
0
# -*- coding: utf-8 -*-

from transliterate import autodiscover
from transliterate.conf import set_setting
from transliterate.utils import get_available_language_codes, translit

set_setting('DEBUG', True)

# Autodiscover available language packs
autodiscover()

print '\nOriginal text\n---------------------------------------'
text = "Lorem ipsum dolor sit amet"
print text

print '\nTransliteration to Armenian\n---------------------------------------'
print translit(text, 'hy')

print '\nTransliteration to Russian\n---------------------------------------'
print translit(text, 'ru')

print '\nList of available (registered) languages\n---------------------------------------'
print get_available_language_codes()

print '\nReversed transliteration from Armenian\n---------------------------------------'
print translit(u'Լօրեմ իպսում դoլoր սիտ ամետ', 'hy', reversed=True)

print '\nReversed transliteration from Russian\n---------------------------------------'
print translit(u'Лорем ипсум долор сит амет', 'ru', reversed=True)

print '\nTesting the function decorator\n---------------------------------------'