Caveats / hacks

NILS and Java’s module-info.java

If you use NILS with a module based application and want to use the resource bundles or other files for the translations of your application you must give access to the folder containing the resource bundles using the open keyword.

module xyz {
  export my.package;
  requires com.codepulsar.nils.core;
  open nls;
}

In the example nls is the folder containing the resource files.

Multiple jars contains "nls/translation" files / NILS-001

If you want to use NILS in a project contains different modules, where (at least) two modules defines it own NilsFactory object, then the error NILS-001 could happen:

NILS-001: Could not find a translation for key 'yourkey' and locale 'de_DE'.

This error occurs because of an erroneous resolution of the translation files.

There is a bug reported (see https://github.com/codepulsar-com/nils/issues/72.)

There are currently two workarounds:

One NilsFactory per project

Define only one NilsFactory to access translation in your project, with only one translation resource.

Unique translation file names per module

Use different name for the translation files so that each module has its own and unique filename.