SHIMA, Japan — President Barack Obama said Thursday that foreign leaders are “rattled” by Donald Trump and have good reason to feel that way, as he accused the presumptive Republican presidential nominee of ignorance about world affairs. Weighing in on the Democratic race to replace him, Obama also downplayed concerns that the protracted fight between Hillary Clinton and Bernie Sanders is hurting his party’s chances, brushing off their escalating attacks as the inevitable “grumpiness” of a primary campaign. Obama offered his assessment of the presidential campaign on the sidelines of a Group of Seven advanced economies summit in Japan, the latest world gathering to be colored by global concerns about Trump.