I have some resource bundles packaged in my main jar
widget_en.properties
widget_de.properties
I retrieve a resource bundle based on my de
A solve it by listing files.
public class JavaApplication1 {
public static final ArrayList LOCALES = new ArrayList<>();
static {
try {
File f = new File(JavaApplication1.class.getResource("/l10n").toURI());
final String bundle = "widget_";// Bundle name prefix.
for (String s : f.list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.startsWith(bundle);
}
})) {
LOCALES.add(s.substring(bundle.length(), s.indexOf('.')));
}
} catch (URISyntaxException x) {
throw new RuntimeException(x);
}
LOCALES.trimToSize();
}
...
}