package xentalker.app;
import java.io.IOException;
import java.io.InputStream;
import org.xml.sax.SAXException;
import xentalker.locale.DirectoryLocalesSource;
import xentalker.locale.LocaleResources;
import xentalker.locale.Localizer;
public final class App {
public static void main(String[] args) {
try {
App app = App.getInstance();
app.init();
} catch (Exception ex) {
System.err.println(ex.getClass().getName() + " - " + ex.getMessage());
Throwable current = ex;
String prefix = "";
while (current.getCause() != null && current.getCause() != ex) {
current = current.getCause();
System.err.println((prefix += "-") + " " + current.getClass().getName() + " - " + current.getMessage());
}
}
}
private static App instance = null;
public static App getInstance() {
if (instance == null)
instance = new App();
return instance;
}
private Localizer localizer;
private App() {
}
public void init() throws IOException, SAXException {
InputStream inputStream = null;
try {
inputStream = App.class.getResourceAsStream("DefaultLocale.xml");
LocaleResources defaultResources = new LocaleResources(inputStream);
inputStream.close();
localizer = new Localizer(defaultResources, new DirectoryLocalesSource("locales"));
} finally {
if (inputStream != null)
inputStream.close();
}
}
public Localizer getLocalizer() {
return localizer;
}
}