Localization transition for a copolymer in an emulsion