Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good Java property files editor

I work on an open-source Java project, and we have a lot of resource property files that contains localizable message resources. Those files are translated by volunteers to 20+ languages, and I'm a developer who primarily edits code.

In Java, resource files for different locales are grouped together by a naming convention. For example, if the default (normally English) resource is "foo.properties", Japanese resource is in "foo_ja.properties", French one is "foo_fr.properties", etc. For the sake of this question, let's call this group a "resource group."

Now, every so often, I need to refactor those resource files. In addition, I need the tool to support the basics of the property files. All in all, my list of requirements are something like:

  1. Renaming property key name, and I want a tool to rename all the keys in all the files in the same group, without me individually going through them.
  2. Move a property from one resource group to another, and I want a tool to do so for each resource file in the group.
  3. In Java, resource files are in the ISO-8859-1 encoding and not in the platform default encoding.
  4. I don't want to see \uXXXX when editing/browsing property files, but I do expect the tool to preserve them.
  5. I don't want the tool to rearrange the order of properties in the resource file, nor mess with the comments. I expect the tool to preserve them.
  6. I want the tool to handle other syntax details of resource files, such as multiline text.

Unfortunately, I'm not finding any good tool that fits these criteria. I'm primarily an IntelliJ IDEA user, but it doesn't do #2 and #3. Eclipse built-in property file editor is even worse, and AFAICT it doesn't do #1, #2, #4. In fact it lacks the view that cuts across resource files in the same group. NetBeans is similarly primitive. The same goes for NetBeans, although it does #4.

Does anyone know of a good tool that fits the bill?

like image 645
Kohsuke Kawaguchi Avatar asked Mar 02 '11 08:03

Kohsuke Kawaguchi


People also ask

Where should the properties file in Java?

Write to the properties file The path/to/config. properties is created.

How do I create a properties file?

Create a properties file Right-click and select Add New Properties File. A new properties file will be added to your project. The new file will be selected and highlighted in the list. Type a name for your properties file, for example, "Properties".

How do I use .properties file?

The Properties file can be used in Java to externalize the configuration and to store the key-value pairs. The Properties. load() method of Properties class is convenient to load . properties file in the form of key-value pairs.


2 Answers

I used plugin for eclipse. I think this one: http://sourceforge.net/projects/eclipse-rbe/

It is OK, allows adding and renaming properties, shows warnings if property is not translated to all supported languages etc.

Its disadvantage is that it always uses `\uXXXX' notation for unicode characters. So, you must use this plugin to read created files. It makes search very hard. And I do not know whether it is possible to configure it to create UTF-8 encoded bundles.

like image 119
AlexR Avatar answered Sep 22 '22 13:09

AlexR


Take a look at the online tool POEditor https://poeditor.com. Its project based.

like image 35
OblongZebra Avatar answered Sep 22 '22 13:09

OblongZebra