middleware helper for translation