def get_current_language(): lang = str(portal.get_current_language()[:2]) languages = get_available_languages_iso() if lang in languages: cur_lang = languages[lang] else: cur_lang = DEFAULT_LANGUAGE return cur_lang
def test_get_current_language(self): """Test that current language is properly returned.""" self.assertEqual(portal.get_current_language(portal.get()), 'en') self.layer['request']['LANGUAGE'] = 'fr' self.assertEqual(portal.get_current_language(), 'fr')