I am currently working on converting an existing web application to support an additional language (namely Welsh). My suggested approach is to extract all displayed text into property files and then access the text using fmt JSTL tags.
My question is: how to structure these property files? I know that they should be in the classpath for the web application, but instead of storing them directly in WEB-INF / classes, I would rather copy them at the build stage. This leaves me with great flexibility in how to store files in subversion. Since they are closely related to jsps, is it a good idea to create a new top-level directory (e.g. resources) and mirror the jsp structure in this folder? That would give me a structure like
resources/jsp/index.properties resources/jsp/index_cy.properties
This seems like a reasonable approach, and it also expands for property files for classes, if needed:
resources/com/mycompany/myapp/CustomObject.properties resources/com/mycompany/myapp/CustomObject_cy.properties
The build process can then copy all these files to WEB-INF / classes, ready to be packaged into a war file.
Does this approach meet industry standards? This is the first multilingual application for my current company, so it will most likely be used as a plan for everyone else.
Edit: It has been pointed out that this approach can lead to a lot of duplication of strings in different property files. Although this is true, in jsps there will only be as many duplicate lines as there currently are. Is it better to have a clear mapping from jsp to property files due to some duplication in the property files?
source share