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