Localization and magnetic properties in cerium compounds