Tool for checking Java resource bundles (i18n) [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this questionI'm searching for a tool, ant-task, IDE plugin, ... which helps with I18N of a Java application using the standard message-properties resource bundles. Both open source and commercial solutions are welcome.
Specifically I'm searching for support in the following tasks:
1) Extract the used keys from Java-code, JSPs and other artifacts. Since custom frameworks are involved the extraction should allow customization.
Mapping of the source artifact to a certain message bundle. Also with custom rules.
Report used keys which are not in the bundle. Report keys which are in the bundle but in none of the source artifact which map to this bundle.
2) Check the property files of each bundle and report missing key definitions and also default translations (uses the English text).
3) Compare the current SVN/CVS/GIT/whatever version with an old version and report cases where one translation (or maybe only the default one) changed but not the other translation.
http://rscbundlecheck.sourceforge.net/ covers 2) to a large part. However I didn't found something for 1) and 3). Any pointers?
Report used keys which are not in the bundle. Report keys which are in the bundle but in none of the source artifact which map to this bundle.
You know, this one is quite untypical and I doubt any framework would include it, since it requires analysing code and determining, which calls are to resource bundle, which can be dynamic strings passed as arguments etc.
Normally the bundles are edited using dedicated editor, f.g. ResourceBundle plugin for Eclipse, in which you edit original and translation simultanously, and you see warnings for each key not present in all translations.
1) Extract the used keys from Java-code, JSPs and other artifacts. Since custom frameworks are involved the extraction should allow customization.
Mapping of the source artifact to a certain message bundle. Also with custom rules.
I've also faced those same issues and started developing a new solution. I just posted it today in my blog. It just uses the Java annotation processor tool to create (or just update) properties files and keys. It is also extensible, as described in the post. And it is available in my GitHub project (you will have to find the link from my blog, as I cannot post more than 2 links).
Feel free to use it and ask whatever you need.
2) Check the property files of each bundle and report missing key definitions and also default translations (uses the English text).
I have also found this solution (haven't tried it yet), and it sounds promising!
Hope it helps!
I implemented the Message Compiler for this purpose, which creates the resource bundle files and constant definitions as Java enum
for the keys from one single source file. So the constants can be used in the Java source code
, which is a much safer way. The message compiler cannot only be used for Java
. It creates also resource files and constants for Objective-C or Swift
and can be extended for other Programming environments.
精彩评论