-
I want to have all the messages on my system in a msg.properties file that follows the key=value pattern, where can I find an example? I tried like below: resources/messages/msg.properties AppMessages.java @MessageBundle
public interface AppMessages {
@Message
String invalidData();
} MyService.java @ApplicationScoped
public class MyService {
@Inject
AppMessages messages;
@Transactional
public void create() throws Exception {
if (true) {
throw new IllegalArgumentException(messages.invalidData());
}
...
}
...
} But I getting the error during the build:
How to solve this problem? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I don't know why when creating a file in IntelliJ even though it is configure for UTF-8, the file is being created with ISO encoding, so I created the file via terminal and another error appears.
If I put the name of the method in the properties file it starts to work, but according to the documentation it was supposed to work using "-" |
Beta Was this translation helpful? Give feedback.
-
The solution was to write the method names in the interface AppMessages with "_" and use the same string in the messages.properties, like:
|
Beta Was this translation helpful? Give feedback.
The solution was to write the method names in the interface AppMessages with "_" and use the same string in the messages.properties, like:
error_invalid_data=msg comes here.