Thermodynamics of Deformable Dielectrics with a Non-Euclidean Structure as Internal Variable