We present a detailed account of a first-order localization transition in the Discrete Nonlinear Schrodinger Equation, where the localized phase is associated to the high energy region in parameter space. We show that, due to ensemble inequivalence, this phase is thermodynamically stable only in the microcanonical ensemble. In particular, we obtain an explicit expression of the microcanonical entropy close to the transition line, located at infinite temperature. This task is accomplished making use of large-deviation techniques, that allow us to compute, in the limit of large system size, also the subleading corrections to the microcanonical entropy. These subleading terms are crucial ingredients to account for the first-order mechanism of the transition, to compute its order parameter and to predict the existence of negative temperatures in the localized phase. All of these features can be viewed as signatures of a thermodynamic phase where the translational symmetry is broken spontaneously due to a condensation mechanism yielding energy fluctuations far away from equipartition: actually they prefer to participate in the formation of nonlinear localized excitations (breathers), typically containing a macroscopic fraction of the total energy.