(Just to avoid any confusion, even though I've been writing a lot about OSGi bundles, the term bundle is only used in the sense of a resource bundle, or properties file, in this article.)
I found two solutions, both of which have minor bugs and lack some documentation but are very helpful nevertheless. And it turned out that the second solution uses code from the first one:
- Resource Bundle Editor from Sourceforge
- Messages Editor from the Eclipse Babel project
However, the Resource Bundle Editor does not parse the properties files correctly. It does not recognize exclamation marks as comment signs. For comment lines of the form
!some.key = some valuethe editor will display a bogus key
!some.key
.Looking at the sources, I found the the PropertiesParser class only recognizes a subset of the valid properties file syntax.
After that, I had a look at the Eclipse Babel editor. Unfortunately, the Babel project does not yet provide binary downloads, so you have to build the two plugins from source.
As it turned out, parts of the Babel sources are derived from the Resource Bundle Editor sources, and the same incomplete parser code is also used in the Eclipse project in class
PropertiesDeserializer
.I changed a regular expression in the source to fix the "!"-problem. You can get the binary plugins including my patch from here:
After installing the plugins, go to Window | Preferences | Messages Editor and deselect the option Setup validation builder on Java projects automatically, or else you may get lots of error markers on other properties files which are not used as message bundles at all. I also set the Reports severities to Ignore and the Displayed Locales to de to narrow the Editor display to the language I'm actually working on.
To edit a resource bundle, select the properties file in the Package Explorer and open it with the Messages Editor via the context menu.
Here is a screenshot of the Messages Editor in action:
With the additional toolbar buttons, you can limit the view to missing or unused translations.
3 comments:
I couldn't get this working. I put the two jars into the plugins folder of Eclipse. Then I launched eclipse with the -clean argument. After that I couldn't find the Messages Editor in Window/Preferences.
Which Eclipse version are you using?
I guess you should put files in dropins directory, not plugins.
Post a Comment