URL url = InternationalResouces.class.getProtectionDomain().getCodeSource().getLocation();
JarFile jarFile = new JarFile(url.getFile());
Enumerationenumeration = jarFile.entries();
while (enumeration.hasMoreElements()) {
JarEntry entry = enumeration.nextElement();
String entryName = entry.getName();
if (entryName.indexOf(path) != -1 && entryName.endsWith("properties")) {
String[] pathGroup = entryName.split("/");
String fileName = pathGroup[pathGroup.length - 1];
String[] nameGroup = fileName.split("\\.");
if (nameGroup.length != 2) {
continue;
}
String realName = nameGroup[0];
String[] realNameGroup = realName.split("_");
if (realNameGroup.length != 2) {
continue;
}
String country = realNameGroup[1];
Properties properties = new Properties();
properties.load(jarFile.getInputStream(entry));
LanguageStore store = new LanguageStore();
store.setCountry(country);
store.setLanguageMap(properties);
languageStore.add(store);
}
}
jarFile.close();