Changed translation function to add term and definition only if successful