[Bugfix] Fixed additional Translation, Configuration Issues

- Fixed translation messages
   - FlightConfiguration, MotorConfiguration
   - correctly display under debug & production
- Fixed exception throw when adding empty-MotorConfiguration to a FlightConfig
This commit is contained in:
Daniel_M_Williams 2016-05-20 18:05:24 -04:00
parent 2ee7464038
commit a6990dddc5
4 changed files with 13 additions and 8 deletions

View File

@ -1477,7 +1477,10 @@ MotorMount.IgnitionEvent.short.EJECTION_CHARGE = Ejection charge
MotorMount.IgnitionEvent.short.BURNOUT = Burnout MotorMount.IgnitionEvent.short.BURNOUT = Burnout
MotorMount.IgnitionEvent.short.NEVER = Never MotorMount.IgnitionEvent.short.NEVER = Never
MotorMount.NoMotors = [No Motors Defined] FlightConfiguration.noMotors = No motors
MotorConfiguration.empty = None
!ComponentIcons !ComponentIcons
ComponentIcons.Stage = Axial Stage ComponentIcons.Stage = Axial Stage

View File

@ -41,13 +41,13 @@ public class RocketSaver extends RocketComponentSaver {
} }
// Motor configurations // Flight configurations
for (FlightConfigurationId fcid : rocket.getIds()) { for (FlightConfigurationId fcid : rocket.getIds()) {
FlightConfiguration flightConfig = rocket.getFlightConfiguration(fcid); FlightConfiguration flightConfig = rocket.getFlightConfiguration(fcid);
if (fcid == null) if (fcid == null)
continue; continue;
// these are actually FlightConfigurationIds, buuuuuuuuuut backwards-compatible tags. // these are actually FlightConfigurationIds, but the old tag name is preserved for backwards-compatibility.
String str = "<motorconfiguration configid=\"" + fcid.key + "\""; String str = "<motorconfiguration configid=\"" + fcid.key + "\"";
// if the configuration is the default, add the tag // if the configuration is the default, add the tag
if ( rocket.getSelectedConfiguration().equals( flightConfig )){ if ( rocket.getSelectedConfiguration().equals( flightConfig )){

View File

@ -1,10 +1,12 @@
package net.sf.openrocket.motor; package net.sf.openrocket.motor;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.rocketcomponent.FlightConfigurableParameter; import net.sf.openrocket.rocketcomponent.FlightConfigurableParameter;
import net.sf.openrocket.rocketcomponent.FlightConfigurationId; import net.sf.openrocket.rocketcomponent.FlightConfigurationId;
import net.sf.openrocket.rocketcomponent.InnerTube; import net.sf.openrocket.rocketcomponent.InnerTube;
import net.sf.openrocket.rocketcomponent.MotorMount; import net.sf.openrocket.rocketcomponent.MotorMount;
import net.sf.openrocket.rocketcomponent.RocketComponent; import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.Coordinate;
import net.sf.openrocket.util.Inertia; import net.sf.openrocket.util.Inertia;
@ -14,7 +16,7 @@ import net.sf.openrocket.util.Inertia;
*/ */
public class MotorConfiguration implements FlightConfigurableParameter<MotorConfiguration> { public class MotorConfiguration implements FlightConfigurableParameter<MotorConfiguration> {
public static final String EMPTY_DESCRIPTION = "Empty Motor Configuration".intern(); private static final Translator trans = Application.getTranslator();
private final MotorMount mount; private final MotorMount mount;
private final FlightConfigurationId fcid; private final FlightConfigurationId fcid;
@ -60,7 +62,7 @@ public class MotorConfiguration implements FlightConfigurableParameter<MotorConf
public String toMotorDescription(){ public String toMotorDescription(){
if( motor == null ){ if( motor == null ){
return "<Empty>"; return trans.get("empty");
}else{ }else{
return this.motor.getDesignation() + "-" + (int)this.getEjectionDelay(); return this.motor.getDesignation() + "-" + (int)this.getEjectionDelay();
} }

View File

@ -314,7 +314,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
} }
} }
if( 0 == activeMotorCount ){ if( 0 == activeMotorCount ){
return trans.get("MotorMount.NoMotors"); return trans.get("noMotors");
} }
buff.append("]"); buff.append("]");
return buff.toString(); return buff.toString();
@ -331,7 +331,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
*/ */
public void addMotor(MotorConfiguration motorConfig) { public void addMotor(MotorConfiguration motorConfig) {
if( motorConfig.isEmpty() ){ if( motorConfig.isEmpty() ){
throw new IllegalArgumentException("MotorInstance is empty."); log.error("attempt to add an empty motorConfig! ignoring. ", new IllegalArgumentException("empty MotorInstance: "+motorConfig.toDebugDetail()));
} }
this.motors.put( motorConfig.getID(), motorConfig); this.motors.put( motorConfig.getID(), motorConfig);