A Weak KAM theorem; from finite to infinite dimension