Modified application startup to set the base translator the same way the

guice startup does - if the locale is set to 'xx' then the base translator
is the debug translator, otherwise the base translator is ResourceBundleTranslator.
You can set the locale by passing '-Duser.language=xx' to the jvm when starting up.
This fixes github issue #17.
This commit is contained in:
soupwizard 2013-04-24 22:32:55 -07:00
parent 1cfdbf7e3f
commit 1ce951e635

View File

@ -1,5 +1,7 @@
package net.sf.openrocket.startup;
import java.util.Locale;
import net.sf.openrocket.database.ComponentPresetDao;
import net.sf.openrocket.database.motor.MotorDatabase;
import net.sf.openrocket.database.motor.ThrustCurveMotorSetDatabase;
@ -7,6 +9,7 @@ import net.sf.openrocket.gui.watcher.WatchService;
import net.sf.openrocket.l10n.ClassBasedTranslator;
import net.sf.openrocket.l10n.DebugTranslator;
import net.sf.openrocket.l10n.ExceptionSuppressingTranslator;
import net.sf.openrocket.l10n.ResourceBundleTranslator;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.logging.LogHelper;
import net.sf.openrocket.logging.LogLevel;
@ -25,7 +28,7 @@ public final class Application {
private static LogHelper logger;
private static LogLevelBufferLogger logBuffer;
private static Translator baseTranslator = new DebugTranslator(null);
private static Translator baseTranslator = new ResourceBundleTranslator("l10n.messages");
private static ComponentPresetDao componentPresetDao;
@ -40,6 +43,13 @@ public final class Application {
setLogOutputLevel(LogLevel.DEBUG);
}
public Application() {
if (Locale.getDefault().getLanguage().equals("xx")) {
baseTranslator = new DebugTranslator(baseTranslator);
}
}
/**
* Return whether to use additional safety code checks.
*/