Before the Second World War, something curious happened to the Japanese language. Foreign place names started changing on the page — and those shifts, researchers have now discovered, tell a story about shifting moods inside Japan.

A team at Tokyo University of Science analyzed more than 300,000 Japanese newspaper articles published between 1912 and 1943 — that's 300,110 articles from 54 different newspapers. Led by Associate Professor Tomoko Matsumoto, the researchers wanted to know whether they could measure exclusionary nationalism, the belief that one's own nation is better than others, simply by watching how people wrote.

Japan's writing system made this possible. Japanese uses three different character sets. Foreign words are usually written in katakana, which looks sharp and angular. Traditional Japanese words use hiragana and kanji. But here's the interesting part: foreign place names could be written either way — in katakana, which sounds and looks foreign, or in ateji, which uses kanji to represent the same sounds. It's a bit like choosing to say "Germany" or "Fatherland" depending on your mood.

The researchers tracked whether writers used katakana or ateji for countries like the United States, Britain, Germany, and Italy. Their hypothesis was simple: when exclusionary attitudes grew stronger, writers would move away from the foreign-sounding katakana and toward the more Japanese-looking ateji.

What they found surprised them. Exclusionary nationalism in Japan did not rise steadily before the Pacific War — it went up and down. The researchers spotted turning points tied to real political events: the coup attempts in 1932 and 1936, Japan's withdrawal from the League of Nations in 1933, the National Mobilization Law in 1938, and the signing of the Tripartite Pact with Germany and Italy in 1940.

The study, published in the journal PLOS ONE, shows that language changes can reveal hidden shifts in how a nation views the outside world. "This method makes it possible to quantitatively grasp the time-series changes in nationalism and perceptions of foreign countries from linguistic data, such as newspapers and social media," said Professor Matsumoto. That matters, she added, because the same technique could help us spot growing divisions in today's world, even in places where nobody runs public opinion polls.

In other words, the words a country uses — and the words it stops using — might be warning signs we can actually read.