[cal10n-user] cal10n 0.8.1 CAL10NBundleFinderByProcessingFiler.getResource()

Michael Newcomb michael.newcomb at gmail.com
Wed May 15 05:59:43 CEST 2013


cal10n is not able to find my resource bundles. It keeps failing saying
that it can't find my resource bundle...

I've tried to understand the code, but it is not very easy to follow. It
seems like it is using the @BaseName.value as the basename for the file,
but it replaces '.' with '/' as if the basename would be a package. That
sounds bad because if you refactor the class the @BaseName is in you would
need to make sure it catches that text package reference.

Anyway, I traced the problem down
into CAL10NBundleFinderByProcessingFiler.getResource(). It uses
StandardLocation.CLASS_OUTPUT... to look for the file.
Then AbstractCAL10NBundleFinder.makePropertyResourceBundle() quietly
swallows the exception that results when it can't find the resource bundle.

So, I guess I'm asking, where do you put your resource bundle when you
follow the example in the documentation:

package com.foo.somePackage;


import ch.qos.cal10n.LocaleData;
import ch.qos.cal10n.Locale;
import ch.qos.cal10n.BaseName;

@BaseName("colors")
@LocaleData( { @Locale("en_UK"), @Locale("fr") })
public enum Colors  {
  BLUE,
  RED,
  YELLOW;
}


I've tried just putting 'colors_en_UK.properties' in the
com.foo.somePackage directory, but that doesn't work because it looks for
that file in <outputdir>/com/foo/somePackage and it isn't there.

I put my resources in a separate folder called 'resources'. I didn't have
that on my javac sourcepath, but I can add that to handle the cal10n
annotation processing. However, StandardLocation.CLASS_OUTPUT would need to
changed to StandardLocation.SOURCE_PATH. I debugged it and re-assigned the
result to use SOURCE_PATH and it behaves like I felt that it should...

Perhaps the CAL10NBundleFinderByProcessingFiler can search most/all of the
StandardLocation.* places instead of just one?

Anyway, it is late and I didn't want to tear up my codebase to figure out
how to make it work, so I'm asking where we should put these things and
what names should they be given...

Thanks,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/cal10n-user/attachments/20130514/b67ec53a/attachment.html>


More information about the cal10n-user mailing list