l10n updates

This commit is contained in:
Sampo Niskanen 2011-07-20 15:44:57 +00:00
parent 8d2c5fd6e7
commit 27caf60161
10 changed files with 363 additions and 244 deletions

View File

@ -144,6 +144,9 @@ debuglogdlg.col.Message = Message
debuglogdlg.lbl.Loglinenbr = Log line number: debuglogdlg.lbl.Loglinenbr = Log line number:
debuglogdlg.lbl.Time = Time: debuglogdlg.lbl.Time = Time:
debuglogdlg.lbl.Level = Level: debuglogdlg.lbl.Level = Level:
debuglogdlg.lbl.Location = Location:
debuglogdlg.lbl.Logmessage = Log message:
debuglogdlg.lbl.Stacktrace = Stack trace:
! Edit Motor configuration dialog ! Edit Motor configuration dialog
@ -485,6 +488,7 @@ componentanalysisdlg.println.settingnam = SETTING NAN VALUES
componentanalysisdlg.lbl.reflenght = Reference length: componentanalysisdlg.lbl.reflenght = Reference length:
componentanalysisdlg.lbl.refarea = Reference area: componentanalysisdlg.lbl.refarea = Reference area:
!componentanalysisdlg.But.close =Close !componentanalysisdlg.But.close =Close
componentanalysisdlg.TabStability.Col.Component = Component
! Custom Material dialog ! Custom Material dialog
custmatdlg.title.Custommaterial = Custom material custmatdlg.title.Custommaterial = Custom material
@ -754,6 +758,7 @@ ParachuteCfg.tab.ttip.Radialpos = Radial position configuration
ParachuteCfg.lbl.Radialdistance = Radial distance: ParachuteCfg.lbl.Radialdistance = Radial distance:
ParachuteCfg.lbl.Radialdirection = Radial direction: ParachuteCfg.lbl.Radialdirection = Radial direction:
ParachuteCfg.but.Reset = Reset ParachuteCfg.but.Reset = Reset
ParachuteCfg.lbl.plusdelay = plus
! ShockCordConfig ! ShockCordConfig
ShockCordCfg.lbl.Shockcordlength = Shock cord length ShockCordCfg.lbl.Shockcordlength = Shock cord length
@ -799,6 +804,7 @@ StreamerCfg.tab.ttip.Radialpos = Radial position configuration
StreamerCfg.lbl.Radialdistance = Radial distance: StreamerCfg.lbl.Radialdistance = Radial distance:
StreamerCfg.lbl.Radialdirection = Radial direction: StreamerCfg.lbl.Radialdirection = Radial direction:
StreamerCfg.but.Reset = Reset StreamerCfg.but.Reset = Reset
StreamerCfg.lbl.plusdelay = plus
! ThicknessRingComponentConfig ! ThicknessRingComponentConfig
ThicknessRingCompCfg.tab.Outerdiam = Outer diameter: ThicknessRingCompCfg.tab.Outerdiam = Outer diameter:

13
scripts/checkTranslations.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
#
# Perform all tests for the translation files.
#
# Usage:
# ./scripts/checkTranslations.sh
#
# Test that keys used in Java files are present in English messages
find src/ -name "*.java" -exec ./scripts/verifyTranslationKeys.pl l10n/messages.properties {} +

View File

@ -0,0 +1,31 @@
#!/bin/bash
#
# Rename translation keys in translation files.
#
# Usage:
# renameTranslationKeys.sh <mapping files...>
#
# The mapping files contain "<original> <new>" key pairs.
# Empty lines and lines starting with "#" are ignored.
# All translation files are modified at once.
#
TRANSLATIONS=messages*.properties
cat "$@" | while read line; do
if echo "$line" | grep -q "^\s*$\|^\s*#"; then
continue
fi
if ! echo "$line" | egrep -q "^\s*[a-zA-Z0-9._-]+\s+[a-zA-Z0-9._-]+\s*$"; then
echo "Invalid line: $line"
fi
from="`echo $line | cut -d" " -f1`"
to="`echo $line | cut -d" " -f2`"
sed -i "s/^${from}\s*=\s*/${to} = /" $TRANSLATIONS
done

View File

@ -0,0 +1,67 @@
#!/usr/bin/perl
#
# Verify that keys used in Java files are present in the translation file.
#
# Usage:
# verifyTranslationKeys.pl <property file> <Java files...>
#
# For example:
# find src/ -name "*.java" -exec ./scripts/verifyTranslationKeys.pl l10n/messages.properties {} +
#
# Read the translation file
my %keys;
print "Reading translation keys...\n";
while ($str = <>) {
if ($ARGV!~/\.properties/) {
last;
}
if ($str=~/^\s*($|[#!])/) {
next;
}
if ($str=~/^([a-zA-Z0-9._-]+)\s*=/) {
$keys{$1} = 1;
} else {
print "ERROR: Invalid line in $ARGV: $str";
}
}
# Read Java files
my $oldFile = $ARGV;
my $class="";
print "Reading Java files...\n";
while ($str = <>) {
# Check for new file
if ($ARGV != $oldFile) {
$class = "";
}
# Check for irregular translator definition (exclude /l10n/ and /startup/)
if ($str =~ / Translator / &&
$str !~ /private static final Translator trans = Application.getTranslator\(\);/ &&
$ARGV !~ /\/(l10n|startup)\//) {
print "ERROR: Unusual translator usage in file $ARGV: $str";
}
# Check for new class definition
if ($str =~ /^[\sa-z]*class ([a-zA-Z0-9]+) /) {
$class = $1;
}
# Check for translator usage
if ($str =~ /trans\.get\(\"([^\"]+)\"\)/) {
$key = $1;
if (!(exists $keys{$key}) &&
!(exists $keys{$class . "." . $key})) {
print "ERROR: Missing translation for '$key' in file $ARGV\n";
}
}
}

View File

@ -17,6 +17,7 @@ import net.sf.openrocket.startup.Application;
public class StageSelector extends JPanel implements ChangeListener { public class StageSelector extends JPanel implements ChangeListener {
private static final Translator trans = Application.getTranslator();
private final Configuration configuration; private final Configuration configuration;
@ -40,7 +41,7 @@ public class StageSelector extends JPanel implements ChangeListener {
return; return;
while (buttons.size() > stages) { while (buttons.size() > stages) {
JToggleButton button = buttons.remove(buttons.size()-1); JToggleButton button = buttons.remove(buttons.size() - 1);
this.remove(button); this.remove(button);
} }
@ -64,7 +65,6 @@ public class StageSelector extends JPanel implements ChangeListener {
private class StageAction extends AbstractAction implements ChangeListener { private class StageAction extends AbstractAction implements ChangeListener {
private final int stage; private final int stage;
private final Translator trans = Application.getTranslator();
public StageAction(final int stage) { public StageAction(final int stage) {
this.stage = stage; this.stage = stage;
@ -76,7 +76,7 @@ public class StageSelector extends JPanel implements ChangeListener {
public Object getValue(String key) { public Object getValue(String key) {
if (key.equals(NAME)) { if (key.equals(NAME)) {
//// Stage //// Stage
return trans.get("StageAction.Stage") + " " + (stage+1); return trans.get("StageAction.Stage") + " " + (stage + 1);
} }
return super.getValue(key); return super.getValue(key);
} }
@ -85,22 +85,22 @@ public class StageSelector extends JPanel implements ChangeListener {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
configuration.setToStage(stage); configuration.setToStage(stage);
// boolean state = (Boolean)getValue(SELECTED_KEY); // boolean state = (Boolean)getValue(SELECTED_KEY);
// if (state == true) { // if (state == true) {
// // Was disabled, now enabled // // Was disabled, now enabled
// configuration.setToStage(stage); // configuration.setToStage(stage);
// } else { // } else {
// // Was enabled, check what to do // // Was enabled, check what to do
// if (configuration.isStageActive(stage + 1)) { // if (configuration.isStageActive(stage + 1)) {
// configuration.setToStage(stage); // configuration.setToStage(stage);
// } else { // } else {
// if (stage == 0) // if (stage == 0)
// configuration.setAllStages(); // configuration.setAllStages();
// else // else
// configuration.setToStage(stage-1); // configuration.setToStage(stage-1);
// } // }
// } // }
// stateChanged(null); // stateChanged(null);
} }

View File

@ -23,8 +23,8 @@ import net.sf.openrocket.gui.components.UnitSelector;
import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.material.Material; import net.sf.openrocket.material.Material;
import net.sf.openrocket.rocketcomponent.MassComponent; import net.sf.openrocket.rocketcomponent.MassComponent;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.rocketcomponent.MotorMount.IgnitionEvent; import net.sf.openrocket.rocketcomponent.MotorMount.IgnitionEvent;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application; import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup; import net.sf.openrocket.unit.UnitGroup;
@ -36,54 +36,54 @@ public class StreamerConfig extends RecoveryDeviceConfig {
JPanel primary = new JPanel(new MigLayout()); JPanel primary = new JPanel(new MigLayout());
JPanel panel = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::][]","")); JPanel panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::][]", ""));
//// Strip length: //// Strip length:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Striplength"))); panel.add(new JLabel(trans.get("StreamerCfg.lbl.Striplength")));
DoubleModel m = new DoubleModel(component,"StripLength",UnitGroup.UNITS_LENGTH,0); DoubleModel m = new DoubleModel(component, "StripLength", UnitGroup.UNITS_LENGTH, 0);
JSpinner spin = new JSpinner(m.getSpinnerModel()); JSpinner spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin)); spin.setEditor(new SpinnerEditor(spin));
panel.add(spin,"growx"); panel.add(spin, "growx");
panel.add(new UnitSelector(m),"growx"); panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(0, 0.6, 1.5)),"w 100lp, wrap"); panel.add(new BasicSlider(m.getSliderModel(0, 0.6, 1.5)), "w 100lp, wrap");
//// Strip width: //// Strip width:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Stripwidth"))); panel.add(new JLabel(trans.get("StreamerCfg.lbl.Stripwidth")));
m = new DoubleModel(component,"StripWidth",UnitGroup.UNITS_LENGTH,0); m = new DoubleModel(component, "StripWidth", UnitGroup.UNITS_LENGTH, 0);
spin = new JSpinner(m.getSpinnerModel()); spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin)); spin.setEditor(new SpinnerEditor(spin));
panel.add(spin,"growx"); panel.add(spin, "growx");
panel.add(new UnitSelector(m),"growx"); panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(0, 0.2)),"w 100lp, wrap 20lp"); panel.add(new BasicSlider(m.getSliderModel(0, 0.2)), "w 100lp, wrap 20lp");
//// Strip area: //// Strip area:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Striparea"))); panel.add(new JLabel(trans.get("StreamerCfg.lbl.Striparea")));
m = new DoubleModel(component,"Area",UnitGroup.UNITS_AREA,0); m = new DoubleModel(component, "Area", UnitGroup.UNITS_AREA, 0);
spin = new JSpinner(m.getSpinnerModel()); spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin)); spin.setEditor(new SpinnerEditor(spin));
panel.add(spin,"growx"); panel.add(spin, "growx");
panel.add(new UnitSelector(m),"growx"); panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(0, 0.04, 0.25)),"w 100lp, wrap"); panel.add(new BasicSlider(m.getSliderModel(0, 0.04, 0.25)), "w 100lp, wrap");
//// Aspect ratio: //// Aspect ratio:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Aspectratio"))); panel.add(new JLabel(trans.get("StreamerCfg.lbl.Aspectratio")));
m = new DoubleModel(component,"AspectRatio",UnitGroup.UNITS_NONE,0); m = new DoubleModel(component, "AspectRatio", UnitGroup.UNITS_NONE, 0);
spin = new JSpinner(m.getSpinnerModel()); spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin)); spin.setEditor(new SpinnerEditor(spin));
panel.add(spin,"growx"); panel.add(spin, "growx");
// panel.add(new UnitSelector(m),"growx"); // panel.add(new UnitSelector(m),"growx");
panel.add(new BasicSlider(m.getSliderModel(2, 15)),"skip, w 100lp, wrap 20lp"); panel.add(new BasicSlider(m.getSliderModel(2, 15)), "skip, w 100lp, wrap 20lp");
//// Material: //// Material:
@ -93,7 +93,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
Material.Type.SURFACE)); Material.Type.SURFACE));
//// The component material affects the weight of the component. //// The component material affects the weight of the component.
combo.setToolTipText(trans.get("StreamerCfg.combo.ttip.MaterialModel")); combo.setToolTipText(trans.get("StreamerCfg.combo.ttip.MaterialModel"));
panel.add(combo,"spanx 3, growx, wrap 20lp"); panel.add(combo, "spanx 3, growx, wrap 20lp");
@ -107,17 +107,17 @@ public class StreamerConfig extends RecoveryDeviceConfig {
label.setToolTipText(tip); label.setToolTipText(tip);
panel.add(label); panel.add(label);
m = new DoubleModel(component,"CD",UnitGroup.UNITS_COEFFICIENT,0); m = new DoubleModel(component, "CD", UnitGroup.UNITS_COEFFICIENT, 0);
spin = new JSpinner(m.getSpinnerModel()); spin = new JSpinner(m.getSpinnerModel());
spin.setToolTipText(tip); spin.setToolTipText(tip);
spin.setEditor(new SpinnerEditor(spin)); spin.setEditor(new SpinnerEditor(spin));
panel.add(spin,"growx"); panel.add(spin, "growx");
JCheckBox check = new JCheckBox(m.getAutomaticAction()); JCheckBox check = new JCheckBox(m.getAutomaticAction());
//// Automatic //// Automatic
check.setText(trans.get("StreamerCfg.lbl.Automatic")); check.setText(trans.get("StreamerCfg.lbl.Automatic"));
panel.add(check,"skip, span, wrap"); panel.add(check, "skip, span, wrap");
//// The drag coefficient is relative to the area of the streamer. //// The drag coefficient is relative to the area of the streamer.
panel.add(new StyledLabel(trans.get("StreamerCfg.lbl.longC1"), panel.add(new StyledLabel(trans.get("StreamerCfg.lbl.longC1"),
@ -126,7 +126,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
primary.add(panel, "grow, gapright 20lp"); primary.add(panel, "grow, gapright 20lp");
panel = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::][]","")); panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::][]", ""));
@ -143,17 +143,17 @@ public class StreamerConfig extends RecoveryDeviceConfig {
RocketComponent.Position.BOTTOM, RocketComponent.Position.BOTTOM,
RocketComponent.Position.ABSOLUTE RocketComponent.Position.ABSOLUTE
})); }));
panel.add(combo,"spanx, growx, wrap"); panel.add(combo, "spanx, growx, wrap");
//// plus //// plus
panel.add(new JLabel(trans.get("StreamerCfg.lbl.plus")),"right"); panel.add(new JLabel(trans.get("StreamerCfg.lbl.plus")), "right");
m = new DoubleModel(component,"PositionValue",UnitGroup.UNITS_LENGTH); m = new DoubleModel(component, "PositionValue", UnitGroup.UNITS_LENGTH);
spin = new JSpinner(m.getSpinnerModel()); spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin)); spin.setEditor(new SpinnerEditor(spin));
panel.add(spin,"growx"); panel.add(spin, "growx");
panel.add(new UnitSelector(m),"growx"); panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel( panel.add(new BasicSlider(m.getSliderModel(
new DoubleModel(component.getParent(), "Length", -1.0, UnitGroup.UNITS_NONE), new DoubleModel(component.getParent(), "Length", -1.0, UnitGroup.UNITS_NONE),
new DoubleModel(component.getParent(), "Length"))), new DoubleModel(component.getParent(), "Length"))),
@ -163,67 +163,67 @@ public class StreamerConfig extends RecoveryDeviceConfig {
//// Spatial length: //// Spatial length:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Packedlength"))); panel.add(new JLabel(trans.get("StreamerCfg.lbl.Packedlength")));
m = new DoubleModel(component,"Length",UnitGroup.UNITS_LENGTH,0); m = new DoubleModel(component, "Length", UnitGroup.UNITS_LENGTH, 0);
spin = new JSpinner(m.getSpinnerModel()); spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin)); spin.setEditor(new SpinnerEditor(spin));
panel.add(spin,"growx"); panel.add(spin, "growx");
panel.add(new UnitSelector(m),"growx"); panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(0, 0.1, 0.5)),"w 100lp, wrap"); panel.add(new BasicSlider(m.getSliderModel(0, 0.1, 0.5)), "w 100lp, wrap");
//// Tube diameter //// Tube diameter
//// Packed diameter: //// Packed diameter:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Packeddiam"))); panel.add(new JLabel(trans.get("StreamerCfg.lbl.Packeddiam")));
DoubleModel od = new DoubleModel(component,"Radius",2,UnitGroup.UNITS_LENGTH,0); DoubleModel od = new DoubleModel(component, "Radius", 2, UnitGroup.UNITS_LENGTH, 0);
// Diameter = 2*Radius // Diameter = 2*Radius
spin = new JSpinner(od.getSpinnerModel()); spin = new JSpinner(od.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin)); spin.setEditor(new SpinnerEditor(spin));
panel.add(spin,"growx"); panel.add(spin, "growx");
panel.add(new UnitSelector(od),"growx"); panel.add(new UnitSelector(od), "growx");
panel.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)),"w 100lp, wrap 30lp"); panel.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)), "w 100lp, wrap 30lp");
//// Deployment //// Deployment
//// Deploys at: //// Deploys at:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Deploysat")),""); panel.add(new JLabel(trans.get("StreamerCfg.lbl.Deploysat")), "");
combo = new JComboBox(new EnumModel<IgnitionEvent>(component, "DeployEvent")); combo = new JComboBox(new EnumModel<IgnitionEvent>(component, "DeployEvent"));
panel.add(combo,"spanx 3, growx, wrap"); panel.add(combo, "spanx 3, growx, wrap");
// ... and delay // ... and delay
//// plus //// plus
panel.add(new JLabel(trans.get("StreamerCfg.lbl.plusdelay")),"right"); panel.add(new JLabel(trans.get("StreamerCfg.lbl.plusdelay")), "right");
m = new DoubleModel(component,"DeployDelay",0); m = new DoubleModel(component, "DeployDelay", 0);
spin = new JSpinner(m.getSpinnerModel()); spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin)); spin.setEditor(new SpinnerEditor(spin));
panel.add(spin,"spanx, split"); panel.add(spin, "spanx, split");
//// seconds //// seconds
panel.add(new JLabel(trans.get("StreamerCfg.lbl.seconds")),"wrap paragraph"); panel.add(new JLabel(trans.get("StreamerCfg.lbl.seconds")), "wrap paragraph");
// Altitude: // Altitude:
label = new JLabel(trans.get("StreamerCfg.lbl.Altitude")); label = new JLabel(trans.get("StreamerCfg.lbl.Altitude"));
altitudeComponents.add(label); altitudeComponents.add(label);
panel.add(label); panel.add(label);
m = new DoubleModel(component,"DeployAltitude",UnitGroup.UNITS_DISTANCE,0); m = new DoubleModel(component, "DeployAltitude", UnitGroup.UNITS_DISTANCE, 0);
spin = new JSpinner(m.getSpinnerModel()); spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin)); spin.setEditor(new SpinnerEditor(spin));
altitudeComponents.add(spin); altitudeComponents.add(spin);
panel.add(spin,"growx"); panel.add(spin, "growx");
UnitSelector unit = new UnitSelector(m); UnitSelector unit = new UnitSelector(m);
altitudeComponents.add(unit); altitudeComponents.add(unit);
panel.add(unit,"growx"); panel.add(unit, "growx");
BasicSlider slider = new BasicSlider(m.getSliderModel(100, 1000)); BasicSlider slider = new BasicSlider(m.getSliderModel(100, 1000));
altitudeComponents.add(slider); altitudeComponents.add(slider);
panel.add(slider,"w 100lp, wrap"); panel.add(slider, "w 100lp, wrap");
primary.add(panel, "grow"); primary.add(panel, "grow");
@ -244,34 +244,34 @@ public class StreamerConfig extends RecoveryDeviceConfig {
protected JPanel positionTab() { protected JPanel positionTab() {
JPanel panel = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::]","")); JPanel panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::]", ""));
//// Radial position //// Radial position
//// Radial distance: //// Radial distance:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Radialdistance"))); panel.add(new JLabel(trans.get("StreamerCfg.lbl.Radialdistance")));
DoubleModel m = new DoubleModel(component,"RadialPosition",UnitGroup.UNITS_LENGTH,0); DoubleModel m = new DoubleModel(component, "RadialPosition", UnitGroup.UNITS_LENGTH, 0);
JSpinner spin = new JSpinner(m.getSpinnerModel()); JSpinner spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin)); spin.setEditor(new SpinnerEditor(spin));
panel.add(spin,"growx"); panel.add(spin, "growx");
panel.add(new UnitSelector(m),"growx"); panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(0, 0.1, 1.0)),"w 100lp, wrap"); panel.add(new BasicSlider(m.getSliderModel(0, 0.1, 1.0)), "w 100lp, wrap");
//// Radial direction //// Radial direction
//// Radial direction: //// Radial direction:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Radialdirection"))); panel.add(new JLabel(trans.get("StreamerCfg.lbl.Radialdirection")));
m = new DoubleModel(component,"RadialDirection",UnitGroup.UNITS_ANGLE,0); m = new DoubleModel(component, "RadialDirection", UnitGroup.UNITS_ANGLE, 0);
spin = new JSpinner(m.getSpinnerModel()); spin = new JSpinner(m.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin)); spin.setEditor(new SpinnerEditor(spin));
panel.add(spin,"growx"); panel.add(spin, "growx");
panel.add(new UnitSelector(m),"growx"); panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(-Math.PI, Math.PI)),"w 100lp, wrap"); panel.add(new BasicSlider(m.getSliderModel(-Math.PI, Math.PI)), "w 100lp, wrap");
//// Reset button //// Reset button
@ -283,7 +283,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
((MassComponent) component).setRadialPosition(0.0); ((MassComponent) component).setRadialPosition(0.0);
} }
}); });
panel.add(button,"spanx, right"); panel.add(button, "spanx, right");
return panel; return panel;
} }

View File

@ -2,6 +2,7 @@
* OpenRocketPrintable.java * OpenRocketPrintable.java
*/ */
package net.sf.openrocket.gui.print; package net.sf.openrocket.gui.print;
import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.startup.Application; import net.sf.openrocket.startup.Application;
@ -18,6 +19,8 @@ public enum OpenRocketPrintable {
//// Design Report //// Design Report
DESIGN_REPORT("OpenRocketPrintable.DesignReport", false, 3); DESIGN_REPORT("OpenRocketPrintable.DesignReport", false, 3);
private static final Translator trans = Application.getTranslator();
/** /**
* The description - will be displayed in the JTree. * The description - will be displayed in the JTree.
*/ */
@ -40,7 +43,7 @@ public enum OpenRocketPrintable {
* @param staged indicates if the printable is stage dependent * @param staged indicates if the printable is stage dependent
* @param idx the relative print order * @param idx the relative print order
*/ */
OpenRocketPrintable (String s, boolean staged, int idx) { OpenRocketPrintable(String s, boolean staged, int idx) {
description = s; description = s;
stageSpecific = staged; stageSpecific = staged;
order = idx; order = idx;
@ -51,8 +54,7 @@ public enum OpenRocketPrintable {
* *
* @return a displayable string * @return a displayable string
*/ */
public String getDescription () { public String getDescription() {
final Translator trans = Application.getTranslator();
return trans.get(description); return trans.get(description);
} }
@ -61,7 +63,7 @@ public enum OpenRocketPrintable {
* *
* @return true if the printable is stage dependent * @return true if the printable is stage dependent
*/ */
public boolean isStageSpecific () { public boolean isStageSpecific() {
return stageSpecific; return stageSpecific;
} }
@ -71,7 +73,7 @@ public enum OpenRocketPrintable {
* *
* @return a 0 based order (0 being first, or highest) * @return a 0 based order (0 being first, or highest)
*/ */
public int getPrintOrder () { public int getPrintOrder() {
return order; return order;
} }
@ -82,7 +84,7 @@ public enum OpenRocketPrintable {
* *
* @return an instance of this enum class or null if not found * @return an instance of this enum class or null if not found
*/ */
public static OpenRocketPrintable findByDescription (String target) { public static OpenRocketPrintable findByDescription(String target) {
OpenRocketPrintable[] values = values(); OpenRocketPrintable[] values = values();
for (OpenRocketPrintable value : values) { for (OpenRocketPrintable value : values) {
if (value.getDescription().equalsIgnoreCase(target)) { if (value.getDescription().equalsIgnoreCase(target)) {

View File

@ -1,13 +1,13 @@
package net.sf.openrocket.rocketcomponent; package net.sf.openrocket.rocketcomponent;
import java.util.List;
import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.material.Material; import net.sf.openrocket.material.Material;
import net.sf.openrocket.startup.Application; import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup; import net.sf.openrocket.unit.UnitGroup;
import net.sf.openrocket.util.Prefs; import net.sf.openrocket.util.Prefs;
import java.util.List;
/** /**
* Class of components with well-defined physical appearance and which have an effect on * Class of components with well-defined physical appearance and which have an effect on
* aerodynamic simulation. They have material defined for them, and the mass of the component * aerodynamic simulation. They have material defined for them, and the mass of the component
@ -30,6 +30,7 @@ public abstract class ExternalComponent extends RocketComponent {
//// Polished //// Polished
POLISHED("ExternalComponent.Polished", 2e-6); POLISHED("ExternalComponent.Polished", 2e-6);
private static final Translator trans = Application.getTranslator();
private final String name; private final String name;
private final double roughnessSize; private final double roughnessSize;
@ -44,7 +45,6 @@ public abstract class ExternalComponent extends RocketComponent {
@Override @Override
public String toString() { public String toString() {
final Translator trans = Application.getTranslator();
return trans.get(name) + " (" + UnitGroup.UNITS_ROUGHNESS.toStringUnit(roughnessSize) + ")"; return trans.get(name) + " (" + UnitGroup.UNITS_ROUGHNESS.toStringUnit(roughnessSize) + ")";
} }
} }

View File

@ -8,17 +8,16 @@ import net.sf.openrocket.util.ChangeSource;
import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.Coordinate;
public interface MotorMount extends ChangeSource { public interface MotorMount extends ChangeSource {
static final Translator trans = Application.getTranslator();
public static enum IgnitionEvent { public static enum IgnitionEvent {
//// Automatic (launch or ejection charge) //// Automatic (launch or ejection charge)
AUTOMATIC(trans.get("MotorMount.IgnitionEvent.AUTOMATIC")) { AUTOMATIC("MotorMount.IgnitionEvent.AUTOMATIC") {
@Override @Override
public boolean isActivationEvent(FlightEvent e, RocketComponent source) { public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
int count = source.getRocket().getStageCount(); int count = source.getRocket().getStageCount();
int stage = source.getStageNumber(); int stage = source.getStageNumber();
if (stage == count-1) { if (stage == count - 1) {
return LAUNCH.isActivationEvent(e, source); return LAUNCH.isActivationEvent(e, source);
} else { } else {
return EJECTION_CHARGE.isActivationEvent(e, source); return EJECTION_CHARGE.isActivationEvent(e, source);
@ -26,14 +25,14 @@ public interface MotorMount extends ChangeSource {
} }
}, },
//// Launch //// Launch
LAUNCH(trans.get("MotorMount.IgnitionEvent.LAUNCH")) { LAUNCH("MotorMount.IgnitionEvent.LAUNCH") {
@Override @Override
public boolean isActivationEvent(FlightEvent e, RocketComponent source) { public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
return (e.getType() == FlightEvent.Type.LAUNCH); return (e.getType() == FlightEvent.Type.LAUNCH);
} }
}, },
//// First ejection charge of previous stage //// First ejection charge of previous stage
EJECTION_CHARGE(trans.get("MotorMount.IgnitionEvent.EJECTION_CHARGE")) { EJECTION_CHARGE("MotorMount.IgnitionEvent.EJECTION_CHARGE") {
@Override @Override
public boolean isActivationEvent(FlightEvent e, RocketComponent source) { public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
if (e.getType() != FlightEvent.Type.EJECTION_CHARGE) if (e.getType() != FlightEvent.Type.EJECTION_CHARGE)
@ -41,11 +40,11 @@ public interface MotorMount extends ChangeSource {
int charge = e.getSource().getStageNumber(); int charge = e.getSource().getStageNumber();
int mount = source.getStageNumber(); int mount = source.getStageNumber();
return (mount+1 == charge); return (mount + 1 == charge);
} }
}, },
//// First burnout of previous stage //// First burnout of previous stage
BURNOUT(trans.get("MotorMount.IgnitionEvent.BURNOUT")) { BURNOUT("MotorMount.IgnitionEvent.BURNOUT") {
@Override @Override
public boolean isActivationEvent(FlightEvent e, RocketComponent source) { public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
if (e.getType() != FlightEvent.Type.BURNOUT) if (e.getType() != FlightEvent.Type.BURNOUT)
@ -53,11 +52,11 @@ public interface MotorMount extends ChangeSource {
int charge = e.getSource().getStageNumber(); int charge = e.getSource().getStageNumber();
int mount = source.getStageNumber(); int mount = source.getStageNumber();
return (mount+1 == charge); return (mount + 1 == charge);
} }
}, },
//// Never //// Never
NEVER(trans.get("MotorMount.IgnitionEvent.NEVER")) { NEVER("MotorMount.IgnitionEvent.NEVER") {
@Override @Override
public boolean isActivationEvent(FlightEvent e, RocketComponent source) { public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
return false; return false;
@ -66,6 +65,7 @@ public interface MotorMount extends ChangeSource {
; ;
private static final Translator trans = Application.getTranslator();
private final String description; private final String description;
IgnitionEvent(String description) { IgnitionEvent(String description) {
@ -76,7 +76,7 @@ public interface MotorMount extends ChangeSource {
@Override @Override
public String toString() { public String toString() {
return description; return trans.get(description);
} }
}; };

View File

@ -15,29 +15,29 @@ import net.sf.openrocket.startup.Application;
public enum LineStyle { public enum LineStyle {
//// Solid //// Solid
SOLID("LineStyle.Solid",new float[] { 10f, 0f }), SOLID("LineStyle.Solid", new float[] { 10f, 0f }),
//// Dashed //// Dashed
DASHED("LineStyle.Dashed",new float[] { 6f, 4f }), DASHED("LineStyle.Dashed", new float[] { 6f, 4f }),
//// Dotted //// Dotted
DOTTED("LineStyle.Dotted",new float[] { 2f, 3f }), DOTTED("LineStyle.Dotted", new float[] { 2f, 3f }),
//// Dash-dotted //// Dash-dotted
DASHDOT("LineStyle.Dash-dotted",new float[] { 8f, 3f, 2f, 3f}) DASHDOT("LineStyle.Dash-dotted", new float[] { 8f, 3f, 2f, 3f });
;
private static final Translator trans = Application.getTranslator();
private final String name; private final String name;
private final float[] dashes; private final float[] dashes;
LineStyle(String name, float[] dashes) { LineStyle(String name, float[] dashes) {
this.name = name; this.name = name;
this.dashes = dashes; this.dashes = dashes;
} }
public float[] getDashes() { public float[] getDashes() {
return Arrays.copyOf(dashes, dashes.length); return Arrays.copyOf(dashes, dashes.length);
} }
@Override @Override
public String toString() { public String toString() {
final Translator trans = Application.getTranslator();
return trans.get(name); return trans.get(name);
} }
} }