Exemple #1
0
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
Exemple #2
0
	def test_changing_language(self):
		language('en')
		self.assertEqual('Missing key testi',msg('missing.key', ('testi',)))
Exemple #3
0
	def test_existing_localization(self):
		language('fi')
		self.assertEqual(u'Reseptiä ei löytynyt',msg('recipe.not.found'))
Exemple #4
0
	def test_existing_localization_with_arguments(self):
		language('fi')
		self.assertEqual('Tallennus parametri puuttu: testi',msg('missing.key', ('testi',)))
Exemple #5
0
	def test_localization(self):
		language('fi')
		self.assertEqual('Missing translation for key ',msg(''))