We present a simple, physically-motivated model to interpret consistently the emission from galaxies at ultraviolet, optical and infrared wavelengths. We combine this model with a Bayesian method to obtain robust statistical constraints on key parameters describing the stellar content, star formation activity and dust content of galaxies. Our model is now publicly available via a user-friendly code package, MAGPHYS at www.iap.fr/magphys. We present an application of this model to interpret a sample of ~1400 local (z<0.5) galaxies from the H-ATLAS survey. We find that, for these galaxies, the diffuse interstellar medium, powered mainly by stars older than 10 Myr, accounts for about half the total infrared luminosity. We discuss the implications of this result to the use of star formation rate indicators based on total infrared luminosity.