Please add the below to have the d.reference_doctype translated as well when doing the Payment Entry.
Under set_remarks(self)
remarks.append(_(“Amount {0} {1} against {2} {3}”).format(self.party_account_currency,
d.allocated_amount, _(d.reference_doctype), d.reference_name))