문제

I create jar file which is enbedded and called as applet from ASP.Net web forms application.

I use ResourceBundle to load localized strings from properties.

I created 3 properties files:

localizedStrings.properties
localizedStrings_de.properties
localizedStrings_en.properties

and load strings with

ResourceBundle labels = ResourceBundle.getBundle("localizedStrings", Locale.GERMAN);

However all strings are loaded from strange location : Login.aspx (which is in the same directory with this applet.jar)

When I call Collections.list(labels.getKeys()).get(0)

I see some contents of Login.aspx in there, very unusual, i have tried with some other bundle names and same results.

What could be the problem here?

도움이 되었습니까?

해결책

I would not say it is strange location. Since you haven't provided any location really, the natural place to look for is the Java classpath. If you want to change it somehow, you need to use fully qualified name for base name, i.e.:

ResourceBundle.getBundle("com.my.company.localizedStrings", Locale.GERMAN);

The only doubt I have, since you probably use something like J# is whether that will work. It should.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top