Invalid property key inspection

If I've got three variations of a bundle (ie messages, message_en, and messages_en_US), and I've got a key which is only present in the base bundle (messages), that's shown as an error, both in the bundle editor and in my code where the @PropertyKey annotation applies.

Question is, isn't this too strict? Isn't it perfectly legal to structure bundles so that the default bundle in the family contains all keys, and the more specific bundles only contain a subset of keys? Especially with messages_en_US, which is only a dialect of en. It would mean a lot of duplication to copy all the keys into all the bundles.

I should think the @PropertyKey inspection shouldn't show this as an error at all. The only time it should show an error is when the string isn't a key in default bundle. And the resource bundle editor should indicate this, but not as an error, just as information (so I can quickly see which bundles define a key).

I guess this could get a little tricky when there is no single base bundle, but rather a set of base bundles (ie I don't create messages, I only create messages_en and messages_fr), in which case it would be an error to define a key in one and not in the other.

Have other people run into this? I wanted to get some feedback before creating a ticket.

Comment actions Permalink

I didn't ran into this myself, but I think your absolutely right. It should be visible that a property is derived from it's parent, but it shouldn't be marked as an error. (And of course by editing its text the property should be created in the correct file.)

I think the case where you don't have a common base bundle is not tricky at all. Just do the same as now, highlight it as an error.

Comment actions Permalink

I guess the only thing that struck me a little tricky was when there was no single common bundle, but a bunch of derived bundles from the several base bundles, ie:


The only rule to enforce would be that every key must be defined in "english" and "german".

Also, I suppose it would be an error to define a key in a derived bundle that isn't in the base bundle(s).


Please sign in to leave a comment.