[JAVA] When internationalizing is supported by Spring Boot, a specific locale is not translated and I am addicted to it

This article is a record that I was addicted to when the Spring Boot application was internationalized in business, the message property file of a specific locale was not recognized. There are many detailed explanations of Spring Boot, so I will omit it.

environment

Prerequisites

In the case where the locale identification is included in the URI at the request of the other party (because it is not directly related to the problem but it is a hint of the addictive highway) ** English **: http://example.jp/en/foo ** Korea **: http://example.jp/ko/foo ** Taiwan **: http://example.jp/zh_tw/foo etc...

why?

The bottom line is that the locale name in the list displayed by locale -a should be the property file name. The problem was that the language code (lowercase) of the URI that was foreshadowed in the prerequisites was used as it was in the file name.

Wrong messages_** zh_tw **. Properties Positive messages _ ** zh_TW **. Properties

The local development environment was mac, but there was no problem recognizing files even in lowercase letters. Here was helpful as to why there was no problem with mac.

Finally

When I write the article again, it seems like it's just a mistake, but it was a problem that took some time to solve. I think it's a niche, but I hope it helps someone someday.

Recommended Posts

When internationalizing is supported by Spring Boot, a specific locale is not translated and I am addicted to it
When I defined a session scope bean in Spring Boot, it behaved strangely and needed to be adjusted.
I want to issue a connection when a database is created using Spring and MyBatis
What I was addicted to when developing a Spring Boot application with VS Code
A memo that I was addicted to when making batch processing with Spring Boot
What I fixed when updating to Spring Boot 1.5.12 ・ What I was addicted to
RSocket is supported in Spring Boot 2.2, so give it a try
What I did when I was addicted to the error "Could not find XXX in any of the sources" when I added a Gem and built it
A story when I tried to make a video by linking Processing and Resolume
What to do when is invalid because it does not start with a'-'
When I call the file with Class # getResource from the jar file, it becomes Not Found and it is a crappy memorandum
Until you create a Spring Boot project in Intellij and push it to Github
A site that was easy to understand when I was a beginner when I started learning Spring Boot
I faced a problem that JS is not read after page transition and JS is read when loaded.
Create a Spring Boot web app that uses IBM Cloudant and deploy it to Cloud Foundry
[MacOS] I was disturbed by ruby when installing Spring Boot CLI
A note when I was addicted to converting Ubuntu on WSL1 to WSL2
When Maven is blocked by a company proxy and doesn't work
How to solve the problem that it is not processed normally when nesting beans in Spring Batch