Extract String Java Constants and identify labels in properties files


I am a newbie with sonar qube and I was trying to learn how to extend some of the sonar scanning capabilities.
I would like to be able to highlight when a new label or String hard-coded sentence is added in the java code.
For example:
String error = “This is an error message”;
The sonar qube linter should be able to highlight this message in the gitlab MR and I would like to be able to get this for the new code as well as for all the existing code.

Do you also know if there is a way to extract all the key-value pairs from file with extension properties that looks like
error.message=This is an error