def response(statuscode, key, arguments=None): """ JSON-response helper :param statuscode: http statuscode :param key: localization key :param arguments: :returns: reponse JSON """ return json.dumps({'message': msg(key, arguments)}, ensure_ascii=False), statuscode
def test_changing_language(self): language('en') self.assertEqual('Missing key testi',msg('missing.key', ('testi',)))
def test_existing_localization(self): language('fi') self.assertEqual(u'Reseptiä ei löytynyt',msg('recipe.not.found'))
def test_existing_localization_with_arguments(self): language('fi') self.assertEqual('Tallennus parametri puuttu: testi',msg('missing.key', ('testi',)))
def test_localization(self): language('fi') self.assertEqual('Missing translation for key ',msg(''))