0
votes

I am trying to use the JLibs I18N library. For the dependencies, I have added the JAR files (i18n and i18n-apt) to the Eclipse Build Path:

Eclipse Build Path

Next, I simply use the sample source code as posted on the website.

import jlibs.core.util.i18n.I18N;
import jlibs.core.util.i18n.Message;
import jlibs.core.util.i18n.ResourceBundle;

@ResourceBundle
public interface DBBundle{
    public static final DBBundle DB_BUNDLE = I18N.getImplementation(DBBundle.class);

    @Message("SQL Execution completed in {0} seconds with {1} errors")
    public String executionFinished(long seconds, int errorCount);

    @Message(key="SQLExecutionException", value="Encountered an exception while executing the following statement:\n{0}")
    public String executionException(String query);

    @Message("executing {0}")
    public String executing(String query);
}

So far I get no compiler errors, which is great.

Moving on in the tutorial, it says

When you compile this interface with jlibs-core.jar in classpath, it will generate Bundle.properties which contains the messages

So I also put jlibs-core into the classpath of Eclipse (see screenshot above) and performed a rebuild. Unfortunately, no Bundle.properties file is created, which I checked with Search Everything: every file is from May or older:

Search Everthing

What else do I need to make Jlibs compile the I18N interface?

1

1 Answers

2
votes

You might have to enable annotation processing in Eclipse. See instructions here.

Add jlibs-i18-apt, jlibs-apt and jlibs-core to the factory path and try.

If you are comfortable with maven you can download a sample maven project. When you compile, you can see generated files in target/classes folder.