From 493c32a7f337bef1f19e1629c99a70a55af8a61a Mon Sep 17 00:00:00 2001 From: bdureau Date: Mon, 14 Feb 2011 14:03:51 +0000 Subject: [PATCH] I18 changes git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/branches/l10n@108 180e2498-e6e9-4542-8430-84ac67f01cd8 --- .../sf/openrocket/aerodynamics/Warning.java | 30 ++-- src/net/sf/openrocket/database/Databases.java | 93 ++++++----- .../gui/components/SimulationExportPanel.java | 24 ++- .../gui/components/StageSelector.java | 6 +- .../gui/configdialog/RingComponentConfig.java | 10 +- .../configdialog/RocketComponentConfig.java | 3 +- .../gui/configdialog/TransitionConfig.java | 4 +- .../gui/dialogs/BugReportDialog.java | 28 ++-- .../dialogs/EditMotorConfigurationDialog.java | 4 +- .../gui/dialogs/ExampleDesignDialog.java | 10 +- .../thrustcurve/ThrustCurveMotorColumns.java | 17 +- .../ThrustCurveMotorSelectionPanel.java | 59 ++++--- .../preferences/PreferencesDialog.java | 20 ++- .../gui/figureelements/RocketInfo.java | 53 +++--- .../sf/openrocket/gui/main/BasicFrame.java | 12 +- .../openrocket/gui/main/ComponentIcons.java | 56 +++++-- .../gui/main/SimulationEditDialog.java | 21 ++- .../gui/plot/PlotConfiguration.java | 6 +- .../gui/plot/SimulationPlotPanel.java | 12 +- .../openrocket/rocketcomponent/BodyTube.java | 8 +- .../openrocket/rocketcomponent/Bulkhead.java | 9 +- .../rocketcomponent/ExternalComponent.java | 20 ++- .../sf/openrocket/rocketcomponent/FinSet.java | 23 ++- .../rocketcomponent/FreeformFinSet.java | 7 +- .../openrocket/rocketcomponent/InnerTube.java | 8 +- .../openrocket/rocketcomponent/LaunchLug.java | 7 +- .../rocketcomponent/MassComponent.java | 7 +- .../rocketcomponent/MotorMount.java | 20 ++- .../openrocket/rocketcomponent/NoseCone.java | 9 +- .../openrocket/rocketcomponent/Parachute.java | 8 +- .../rocketcomponent/RecoveryDevice.java | 18 +- .../sf/openrocket/rocketcomponent/Rocket.java | 8 +- .../rocketcomponent/RocketComponent.java | 19 ++- .../openrocket/rocketcomponent/ShockCord.java | 8 +- .../sf/openrocket/rocketcomponent/Stage.java | 8 +- .../rocketcomponent/Transition.java | 109 ++++++------ .../rocketcomponent/TrapezoidFinSet.java | 7 +- .../rocketcomponent/TubeCoupler.java | 9 +- .../openrocket/simulation/FlightDataType.java | 158 ++++++++++++------ .../sf/openrocket/simulation/FlightEvent.java | 41 +++-- src/net/sf/openrocket/util/LineStyle.java | 22 ++- src/net/sf/openrocket/util/Prefs.java | 12 +- 42 files changed, 647 insertions(+), 366 deletions(-) diff --git a/src/net/sf/openrocket/aerodynamics/Warning.java b/src/net/sf/openrocket/aerodynamics/Warning.java index 7981d37a..e44541c0 100644 --- a/src/net/sf/openrocket/aerodynamics/Warning.java +++ b/src/net/sf/openrocket/aerodynamics/Warning.java @@ -1,10 +1,13 @@ package net.sf.openrocket.aerodynamics; +import net.sf.openrocket.l10n.Translator; +import net.sf.openrocket.startup.Application; import net.sf.openrocket.unit.UnitGroup; public abstract class Warning { - + private static final Translator trans = Application.getTranslator(); + /** * Return a Warning with the specific text. */ @@ -69,8 +72,10 @@ public abstract class Warning { @Override public String toString() { if (Double.isNaN(aoa)) - return "Large angle of attack encountered."; - return ("Large angle of attack encountered (" + + //// Large angle of attack encountered. + return trans.get("Warning.LargeAOA.str1"); + //// Large angle of attack encountered ( + return (trans.get("Warning.LargeAOA.str2") + UnitGroup.UNITS_ANGLE.getDefaultUnit().toString(aoa) + ")."); } @@ -129,26 +134,31 @@ public abstract class Warning { /** A Warning that the body diameter is discontinuous. */ +////Discontinuity in rocket body diameter. public static final Warning DISCONTINUITY = - new Other("Discontinuity in rocket body diameter."); + new Other(trans.get("Warning.DISCONTINUITY")); /** A Warning that the fins are thick compared to the rocket body. */ +////Thick fins may not be modeled accurately. public static final Warning THICK_FIN = - new Other("Thick fins may not be modeled accurately."); + new Other(trans.get("Warning.THICK_FIN")); /** A Warning that the fins have jagged edges. */ +////Jagged-edged fin predictions may be inaccurate. public static final Warning JAGGED_EDGED_FIN = - new Other("Jagged-edged fin predictions may be inaccurate."); + new Other(trans.get("Warning.JAGGED_EDGED_FIN")); /** A Warning that simulation listeners have affected the simulation */ +////Listeners modified the flight simulation public static final Warning LISTENERS_AFFECTED = - new Other("Listeners modified the flight simulation"); + new Other(trans.get("Warning.LISTENERS_AFFECTED")); +////Recovery device opened while motor still burning. public static final Warning RECOVERY_DEPLOYMENT_WHILE_BURNING = - new Other("Recovery device opened while motor still burning."); - + new Other(trans.get("Warning.RECOVERY_DEPLOYMENT_WHILE_BURNING")); + //// Invalid parameter encountered, ignoring. public static final Warning FILE_INVALID_PARAMETER = - new Other("Invalid parameter encountered, ignoring."); + new Other(trans.get("Warning.FILE_INVALID_PARAMETER")); } diff --git a/src/net/sf/openrocket/database/Databases.java b/src/net/sf/openrocket/database/Databases.java index fe6abcbf..52b93534 100644 --- a/src/net/sf/openrocket/database/Databases.java +++ b/src/net/sf/openrocket/database/Databases.java @@ -1,5 +1,6 @@ package net.sf.openrocket.database; +import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.logging.LogHelper; import net.sf.openrocket.material.Material; import net.sf.openrocket.material.MaterialStorage; @@ -15,7 +16,8 @@ import net.sf.openrocket.util.Prefs; */ public class Databases { private static final LogHelper log = Application.getLogger(); - + private static final Translator trans = Application.getTranslator(); + /* Static implementations of specific databases: */ /** @@ -36,48 +38,59 @@ public class Databases { static { // Add default materials - BULK_MATERIAL.add(new Material.Bulk("Acrylic", 1190, false)); - BULK_MATERIAL.add(new Material.Bulk("Balsa", 170, false)); - BULK_MATERIAL.add(new Material.Bulk("Birch", 670, false)); - BULK_MATERIAL.add(new Material.Bulk("Cardboard", 680, false)); - BULK_MATERIAL.add(new Material.Bulk("Carbon fiber", 1780, false)); - BULK_MATERIAL.add(new Material.Bulk("Cork", 240, false)); - BULK_MATERIAL.add(new Material.Bulk("Depron (XPS)", 40, false)); - BULK_MATERIAL.add(new Material.Bulk("Fiberglass", 1850, false)); - BULK_MATERIAL.add(new Material.Bulk("Kraft phenolic", 950, false)); - BULK_MATERIAL.add(new Material.Bulk("Maple", 755, false)); - BULK_MATERIAL.add(new Material.Bulk("Paper (office)", 820, false)); - BULK_MATERIAL.add(new Material.Bulk("Pine", 530, false)); - BULK_MATERIAL.add(new Material.Bulk("Plywood (birch)", 630, false)); - BULK_MATERIAL.add(new Material.Bulk("Polycarbonate (Lexan)", 1200, false)); - BULK_MATERIAL.add(new Material.Bulk("Polystyrene", 1050, false)); - BULK_MATERIAL.add(new Material.Bulk("PVC", 1390, false)); - BULK_MATERIAL.add(new Material.Bulk("Spruce", 450, false)); - BULK_MATERIAL.add(new Material.Bulk("Styrofoam (generic EPS)", 20, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.Acrylic"), 1190, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.Balsa"), 170, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.Birch"), 670, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.Cardboard"), 680, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.Carbonfiber"), 1780, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.Cork"), 240, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.DepronXPS"), 40, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.Fiberglass"), 1850, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.Kraftphenolic"), 950, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.Maple"), 755, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.Paperoffice"), 820, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.Pine"), 530, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.Plywoodbirch"), 630, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.PolycarbonateLexan"), 1200, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.Polystyrene"), 1050, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.PVC"), 1390, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.Spruce"), 450, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.StyrofoamgenericEPS"), 20, false)); // BULK_MATERIAL.add(new Material.Bulk("Styrofoam (Blue foam, XPS)", 32, false)); - BULK_MATERIAL.add(new Material.Bulk("Styrofoam \"Blue foam\" (XPS)", 32, false)); - BULK_MATERIAL.add(new Material.Bulk("Quantum tubing", 1050, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.StyrofoamBluefoamXPS"), 32, false)); + BULK_MATERIAL.add(new Material.Bulk(trans.get("Databases.materials.Quantumtubing"), 1050, false)); - SURFACE_MATERIAL.add(new Material.Surface("Ripstop nylon", 0.067, false)); - SURFACE_MATERIAL.add(new Material.Surface("Mylar", 0.021, false)); - SURFACE_MATERIAL.add(new Material.Surface("Polyethylene (thin)", 0.015, false)); - SURFACE_MATERIAL.add(new Material.Surface("Polyethylene (heavy)", 0.040, false)); - SURFACE_MATERIAL.add(new Material.Surface("Silk", 0.060, false)); - SURFACE_MATERIAL.add(new Material.Surface("Paper (office)", 0.080, false)); - SURFACE_MATERIAL.add(new Material.Surface("Cellophane", 0.018, false)); - SURFACE_MATERIAL.add(new Material.Surface("Cr\u00eape paper", 0.025, false)); + SURFACE_MATERIAL.add(new Material.Surface(trans.get("Databases.materials.Ripstopnylon"), 0.067, false)); + SURFACE_MATERIAL.add(new Material.Surface(trans.get("Databases.materials.Mylar"), 0.021, false)); + SURFACE_MATERIAL.add(new Material.Surface(trans.get("Databases.materials.Polyethylenethin"), 0.015, false)); + SURFACE_MATERIAL.add(new Material.Surface(trans.get("Databases.materials.Polyethyleneheavy"), 0.040, false)); + SURFACE_MATERIAL.add(new Material.Surface(trans.get("Databases.materials.Silk"), 0.060, false)); + SURFACE_MATERIAL.add(new Material.Surface(trans.get("Databases.materials.Paperoffice"), 0.080, false)); + SURFACE_MATERIAL.add(new Material.Surface(trans.get("Databases.materials.Cellophane"), 0.018, false)); + SURFACE_MATERIAL.add(new Material.Surface(trans.get("Databases.materials.Creapepaper"), 0.025, false)); - LINE_MATERIAL.add(new Material.Line("Thread (heavy-duty)", 0.0003, false)); - LINE_MATERIAL.add(new Material.Line("Elastic cord (round 2mm, 1/16 in)", 0.0018, false)); - LINE_MATERIAL.add(new Material.Line("Elastic cord (flat 6mm, 1/4 in)", 0.0043, false)); - LINE_MATERIAL.add(new Material.Line("Elastic cord (flat 12mm, 1/2 in)", 0.008, false)); - LINE_MATERIAL.add(new Material.Line("Elastic cord (flat 19mm, 3/4 in)", 0.0012, false)); - LINE_MATERIAL.add(new Material.Line("Elastic cord (flat 25mm, 1 in)", 0.0016, false)); - LINE_MATERIAL.add(new Material.Line("Braided nylon (2 mm, 1/16 in)", 0.001, false)); - LINE_MATERIAL.add(new Material.Line("Braided nylon (3 mm, 1/8 in)", 0.0035, false)); - LINE_MATERIAL.add(new Material.Line("Tubular nylon (11 mm, 7/16 in)", 0.013, false)); - LINE_MATERIAL.add(new Material.Line("Tubular nylon (14 mm, 9/16 in)", 0.016, false)); - LINE_MATERIAL.add(new Material.Line("Tubular nylon (25 mm, 1 in)", 0.029, false)); + //// Thread (heavy-duty) + LINE_MATERIAL.add(new Material.Line(trans.get("Databases.materials.Threadheavy-duty"), 0.0003, false)); + //// Elastic cord (round 2mm, 1/16 in) + LINE_MATERIAL.add(new Material.Line(trans.get("Databases.materials.Elasticcordround2mm"), 0.0018, false)); + //// Elastic cord (flat 6mm, 1/4 in) + LINE_MATERIAL.add(new Material.Line(trans.get("Databases.materials.Elasticcordflat6mm"), 0.0043, false)); + //// Elastic cord (flat 12mm, 1/2 in) + LINE_MATERIAL.add(new Material.Line(trans.get("Databases.materials.Elasticcordflat12mm"), 0.008, false)); + //// Elastic cord (flat 19mm, 3/4 in) + LINE_MATERIAL.add(new Material.Line(trans.get("Databases.materials.Elasticcordflat19mm"), 0.0012, false)); + //// Elastic cord (flat 25mm, 1 in) + LINE_MATERIAL.add(new Material.Line(trans.get("Databases.materials.Elasticcordflat25mm"), 0.0016, false)); + //// Braided nylon (2 mm, 1/16 in) + LINE_MATERIAL.add(new Material.Line(trans.get("Databases.materials.Braidednylon2mm"), 0.001, false)); + //// Braided nylon (3 mm, 1/8 in) + LINE_MATERIAL.add(new Material.Line(trans.get("Databases.materials.Braidednylon3mm"), 0.0035, false)); + //// Tubular nylon (11 mm, 7/16 in) + LINE_MATERIAL.add(new Material.Line(trans.get("Databases.materials.Tubularnylon11mm"), 0.013, false)); + //// Tubular nylon (14 mm, 9/16 in) + LINE_MATERIAL.add(new Material.Line(trans.get("Databases.materials.Tubularnylon14mm"), 0.016, false)); + //// Tubular nylon (25 mm, 1 in) + LINE_MATERIAL.add(new Material.Line(trans.get("Databases.materials.Tubularnylon25mm"), 0.029, false)); // Add user-defined materials diff --git a/src/net/sf/openrocket/gui/components/SimulationExportPanel.java b/src/net/sf/openrocket/gui/components/SimulationExportPanel.java index ffdfa148..62f79d6d 100644 --- a/src/net/sf/openrocket/gui/components/SimulationExportPanel.java +++ b/src/net/sf/openrocket/gui/components/SimulationExportPanel.java @@ -285,9 +285,13 @@ public class SimulationExportPanel extends JPanel { } if (file.exists()) { - int ret = JOptionPane.showConfirmDialog(this, - "File \"" + file.getName() + "\" exists. Overwrite?", - "File exists", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + int ret = JOptionPane.showConfirmDialog(this, + //// File + trans.get("SimExpPan.Fileexists.desc1") + file.getName() + + //// \" exists. Overwrite? + trans.get("SimExpPan.Fileexists.desc2"), + //// File exists + trans.get("SimExpPan.Fileexists.title"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (ret != JOptionPane.YES_OPTION) return; } @@ -348,9 +352,13 @@ public class SimulationExportPanel extends JPanel { } if (n == 1) { - str = "Exporting 1 variable out of " + total + "."; + //// Exporting 1 variable out of + str = trans.get("SimExpPan.ExportingVar.desc1") + " " + total + "."; } else { - str = "Exporting "+n+" variables out of " + total + "."; + //// Exporting + //// variables out of + str = trans.get("SimExpPan.ExportingVar.desc2") + " "+n+" " + + trans.get("SimExpPan.ExportingVar.desc3") + " " + total + "."; } selectedCountLabel.setText(str); @@ -415,9 +423,11 @@ public class SimulationExportPanel extends JPanel { case SELECTED: return ""; case NAME: - return "Variable"; + //// Variable + return trans.get("SimExpPan.Col.Variable"); case UNIT: - return "Unit"; + //// Unit + return trans.get("SimExpPan.Col.Unit"); default: throw new IndexOutOfBoundsException("column=" + column); } diff --git a/src/net/sf/openrocket/gui/components/StageSelector.java b/src/net/sf/openrocket/gui/components/StageSelector.java index 5b5e78ae..13a98890 100644 --- a/src/net/sf/openrocket/gui/components/StageSelector.java +++ b/src/net/sf/openrocket/gui/components/StageSelector.java @@ -11,7 +11,9 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import net.miginfocom.swing.MigLayout; +import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.rocketcomponent.Configuration; +import net.sf.openrocket.startup.Application; public class StageSelector extends JPanel implements ChangeListener { @@ -62,6 +64,7 @@ public class StageSelector extends JPanel implements ChangeListener { private class StageAction extends AbstractAction implements ChangeListener { private final int stage; + private final Translator trans = Application.getTranslator(); public StageAction(final int stage) { this.stage = stage; @@ -72,7 +75,8 @@ public class StageSelector extends JPanel implements ChangeListener { @Override public Object getValue(String key) { if (key.equals(NAME)) { - return "Stage "+(stage+1); + //// Stage + return trans.get("StageAction.Stage") + " " + (stage+1); } return super.getValue(key); } diff --git a/src/net/sf/openrocket/gui/configdialog/RingComponentConfig.java b/src/net/sf/openrocket/gui/configdialog/RingComponentConfig.java index a5c74943..a1c49ef6 100644 --- a/src/net/sf/openrocket/gui/configdialog/RingComponentConfig.java +++ b/src/net/sf/openrocket/gui/configdialog/RingComponentConfig.java @@ -160,10 +160,8 @@ public class RingComponentConfig extends RocketComponentConfig { if (component instanceof EngineBlock) { final DescriptionArea desc = new DescriptionArea(6); - desc.setText("An engine block stops the motor from moving forwards " + - "in the motor mount tube.

In order to add a motor, create a " + - "body tube or inner tube and mark it as a motor mount in " + - "the Motor tab."); + //// An engine block stops the motor from moving forwards in the motor mount tube.

In order to add a motor, create a body tube or inner tube and mark it as a motor mount in the Motor tab. + desc.setText(trans.get("ringcompcfg.EngineBlock.desc")); sub.add(desc, "width 1px, growx, wrap"); } panel.add(sub,"cell 4 0, gapleft paragraph, aligny 0%, spany"); @@ -233,8 +231,8 @@ public class RingComponentConfig extends RocketComponentConfig { DescriptionArea note = new DescriptionArea(2); - note.setText("Note: An inner tube will not affect the aerodynamics" + - " of the rocket even if it is located outside of the body tube."); + //// Note: An inner tube will not affect the aerodynamics of the rocket even if it is located outside of the body tube. + note.setText(trans.get("ringcompcfg.note.desc")); panel.add(note, "spanx, growx"); diff --git a/src/net/sf/openrocket/gui/configdialog/RocketComponentConfig.java b/src/net/sf/openrocket/gui/configdialog/RocketComponentConfig.java index 101b8099..448a449c 100644 --- a/src/net/sf/openrocket/gui/configdialog/RocketComponentConfig.java +++ b/src/net/sf/openrocket/gui/configdialog/RocketComponentConfig.java @@ -418,7 +418,8 @@ public class RocketComponentConfig extends JPanel { System.arraycopy(LineStyle.values(), 0, list, 1, LineStyle.values().length); JComboBox combo = new JComboBox(new EnumModel(component, "LineStyle", - list, "Default style")); + //// Default style + list, trans.get("LineStyle.Defaultstyle"))); panel.add(combo, "spanx 2, growx, wrap 50lp"); //// Save as default style diff --git a/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java b/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java index c512d4dd..513c49eb 100644 --- a/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java +++ b/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java @@ -72,7 +72,7 @@ public class TransitionConfig extends RocketComponentConfig { panel.add(typeBox,"span, split 2"); //// Clipped - checkbox = new JCheckBox(new BooleanModel(component,trans.get("TransitionCfg.checkbox.Clipped"))); + checkbox = new JCheckBox(new BooleanModel(component,"Clipped")); //// Clipped checkbox.setText(trans.get("TransitionCfg.checkbox.Clipped")); panel.add(checkbox,"wrap"); @@ -163,7 +163,7 @@ public class TransitionConfig extends RocketComponentConfig { panel.add(new BasicSlider(m.getSliderModel(0,0.01)),"w 100lp, wrap 0px"); //// Filled - checkbox = new JCheckBox(new BooleanModel(component,trans.get("TransitionCfg.checkbox.Filled"))); + checkbox = new JCheckBox(new BooleanModel(component,"Filled")); //// Filled checkbox.setText(trans.get("TransitionCfg.checkbox.Filled")); panel.add(checkbox,"skip, span 2, wrap"); diff --git a/src/net/sf/openrocket/gui/dialogs/BugReportDialog.java b/src/net/sf/openrocket/gui/dialogs/BugReportDialog.java index e916caad..9966dbe5 100644 --- a/src/net/sf/openrocket/gui/dialogs/BugReportDialog.java +++ b/src/net/sf/openrocket/gui/dialogs/BugReportDialog.java @@ -60,15 +60,14 @@ public class BugReportDialog extends JDialog { //// If connected to the Internet, you can simply click //// Send bug report. - label = new JLabel("If connected to the Internet, you can simply click " + - "Send bug report."); + label = new JLabel(trans.get("bugreport.dlg.connectedInternet")); d = label.getPreferredSize(); d.width = 100000; label.setMaximumSize(d); panel.add(label, "gapleft para, wrap"); //// Otherwise, send the text below to the address: - panel.add(new JLabel("Otherwise, send the text below to the address: "), + panel.add(new JLabel(trans.get("bugreport.dlg.otherwise") +" "), "gapleft para, split 2, gapright rel"); panel.add(new SelectableLabel(REPORT_EMAIL), "growx, wrap para"); @@ -78,9 +77,7 @@ public class BugReportDialog extends JDialog { panel.add(new JScrollPane(textArea), "grow, wrap"); - panel.add(new StyledLabel("The information above may be included in a public " + - "bug report. Make sure it does not contain any sensitive information you " + - "do not want to be made public.", -1), "wrap para"); + panel.add(new StyledLabel(trans.get("bugreport.lbl.Theinformation"), -1), "wrap para"); @@ -136,10 +133,13 @@ public class BugReportDialog extends JDialog { } catch (Exception ex) { // Sending the message failed. JOptionPane.showMessageDialog(BugReportDialog.this, - new Object[] { "OpenRocket was unable to send the bug report:", + //// OpenRocket was unable to send the bug report: + new Object[] { trans.get("bugreport.dlg.failedmsg1"), ex.getClass().getSimpleName() + ": " + ex.getMessage(), " ", - "Please send the report manually to " + REPORT_EMAIL }, - "Error sending report", JOptionPane.ERROR_MESSAGE); + //// Please send the report manually to + trans.get("bugreport.dlg.failedmsg2") +" " + REPORT_EMAIL }, + //// Error sending report + trans.get("bugreport.dlg.failedmsg3"), JOptionPane.ERROR_MESSAGE); } } }); @@ -199,10 +199,8 @@ public class BugReportDialog extends JDialog { BugReportDialog reportDialog = new BugReportDialog(parent, - "You can report a bug in OpenRocket by filling in and submitting " + - "the form below.
" + - "You can also report bugs and include attachments on the project " + - "web site.", sb.toString()); + //// You can report a bug in OpenRocket by filling in and submitting the form below.
You can also report bugs and include attachments on the project web site. + trans.get("bugreport.reportDialog.txt"), sb.toString()); reportDialog.setVisible(true); } @@ -260,8 +258,8 @@ public class BugReportDialog extends JDialog { sb.append('\n'); BugReportDialog reportDialog = - new BugReportDialog(parent, "Please include a short description about " + - "what you were doing when the exception occurred.", sb.toString()); + //// Please include a short description about what you were doing when the exception occurred. + new BugReportDialog(parent, trans.get("bugreport.reportDialog.txt2"), sb.toString()); reportDialog.setVisible(true); } diff --git a/src/net/sf/openrocket/gui/dialogs/EditMotorConfigurationDialog.java b/src/net/sf/openrocket/gui/dialogs/EditMotorConfigurationDialog.java index 59c0defb..b1ef4a9c 100644 --- a/src/net/sf/openrocket/gui/dialogs/EditMotorConfigurationDialog.java +++ b/src/net/sf/openrocket/gui/dialogs/EditMotorConfigurationDialog.java @@ -473,6 +473,7 @@ public class EditMotorConfigurationDialog extends JDialog { MotorMount mount = findMount(column); Motor motor = mount.getMotor(id); if (motor == null) + //// None return "None"; String str = motor.getDesignation(mount.getMotorDelay(id)); @@ -487,7 +488,8 @@ public class EditMotorConfigurationDialog extends JDialog { @Override public String getColumnName(int column) { if (column == 0) { - return "Configuration name"; + //// Configuration name + return trans.get("edtmotorconfdlg.lbl.Configname"); } MotorMount mount = findMount(column); diff --git a/src/net/sf/openrocket/gui/dialogs/ExampleDesignDialog.java b/src/net/sf/openrocket/gui/dialogs/ExampleDesignDialog.java index a15b624e..069791ab 100644 --- a/src/net/sf/openrocket/gui/dialogs/ExampleDesignDialog.java +++ b/src/net/sf/openrocket/gui/dialogs/ExampleDesignDialog.java @@ -52,12 +52,12 @@ public class ExampleDesignDialog extends JDialog { private ExampleDesignDialog(ExampleDesign[] designs, Window parent) { //// Open example design - super(parent, "Open example design", Dialog.ModalityType.APPLICATION_MODAL); + super(parent, trans.get("exdesigndlg.lbl.Openexampledesign"), Dialog.ModalityType.APPLICATION_MODAL); JPanel panel = new JPanel(new MigLayout("fill")); //// Select example designs to open: - panel.add(new JLabel("Select example designs to open:"), "wrap"); + panel.add(new JLabel(trans.get("exdesigndlg.lbl.Selectexample")), "wrap"); designSelection = new JList(designs); designSelection.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); @@ -73,7 +73,7 @@ public class ExampleDesignDialog extends JDialog { panel.add(new JScrollPane(designSelection), "grow, wmin 300lp, wrap para"); //// Open button - JButton openButton = new JButton(trans.get("debuglogdlg.but.clear")); + JButton openButton = new JButton(trans.get("exdesigndlg.but.open")); openButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -119,9 +119,9 @@ public class ExampleDesignDialog extends JDialog { } if (designs == null || designs.length == 0) { //// Example designs could not be found. - JOptionPane.showMessageDialog(parent, "Example designs could not be found.", + JOptionPane.showMessageDialog(parent, trans.get("exdesigndlg.lbl.Exampledesignsnotfound"), //// Examples not found - "Examples not found", JOptionPane.ERROR_MESSAGE); + trans.get("exdesigndlg.lbl.Examplesnotfound"), JOptionPane.ERROR_MESSAGE); return null; } diff --git a/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java b/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java index 50eb75d6..d4cefca2 100644 --- a/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java +++ b/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorColumns.java @@ -18,7 +18,8 @@ import net.sf.openrocket.unit.ValueComparator; */ enum ThrustCurveMotorColumns { - MANUFACTURER("Manufacturer", 100) { + //// Manufacturer + MANUFACTURER("TCurveMotorCol.MANUFACTURER", 100) { @Override public String getValue(ThrustCurveMotorSet m) { return m.getManufacturer().getDisplayName(); @@ -29,7 +30,8 @@ enum ThrustCurveMotorColumns { return Collator.getInstance(); } }, - DESIGNATION("Designation") { + //// Designation + DESIGNATION("TCurveMotorCol.DESIGNATION") { @Override public String getValue(ThrustCurveMotorSet m) { return m.getDesignation(); @@ -40,7 +42,8 @@ enum ThrustCurveMotorColumns { return new DesignationComparator(); } }, - TYPE("Type") { + //// Type + TYPE("TCurveMotorCol.TYPE") { @Override public String getValue(ThrustCurveMotorSet m) { return m.getType().getName(); @@ -51,7 +54,8 @@ enum ThrustCurveMotorColumns { return Collator.getInstance(); } }, - DIAMETER("Diameter") { + //// Diameter + DIAMETER("TCurveMotorCol.DIAMETER") { @Override public Object getValue(ThrustCurveMotorSet m) { return new Value(m.getDiameter(), UnitGroup.UNITS_MOTOR_DIMENSIONS); @@ -62,7 +66,8 @@ enum ThrustCurveMotorColumns { return ValueComparator.INSTANCE; } }, - LENGTH("Length") { + //// Length + LENGTH("TCurveMotorCol.LENGTH") { @Override public Object getValue(ThrustCurveMotorSet m) { return new Value(m.getLength(), UnitGroup.UNITS_MOTOR_DIMENSIONS); @@ -94,7 +99,7 @@ enum ThrustCurveMotorColumns { public abstract Comparator getComparator(); public String getTitle() { - return title; + return trans.get(title); } public int getWidth() { diff --git a/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java b/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java index 359c485b..ca0fb811 100644 --- a/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java +++ b/src/net/sf/openrocket/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java @@ -81,9 +81,12 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec private static final int SHOW_SMALLER = 1; private static final int SHOW_EXACT = 2; private static final String[] SHOW_DESCRIPTIONS = { - "Show all motors", - "Show motors with diameter less than that of the motor mount", - "Show motors with diameter equal to that of the motor mount" + //// Show all motors + trans.get("TCMotorSelPan.SHOW_DESCRIPTIONS.desc1"), + //// Show motors with diameter less than that of the motor mount + trans.get("TCMotorSelPan.SHOW_DESCRIPTIONS.desc2"), + //// Show motors with diameter equal to that of the motor mount + trans.get("TCMotorSelPan.SHOW_DESCRIPTIONS.desc3") }; private static final int SHOW_MAX = 2; @@ -194,7 +197,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec // Selection label //// Select rocket motor: - label = new StyledLabel("Select rocket motor:", Style.BOLD); + label = new StyledLabel(trans.get("TCMotorSelPan.lbl.Selrocketmotor"), Style.BOLD); panel.add(label, "spanx, wrap para"); // Diameter selection @@ -229,7 +232,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec panel.add(filterComboBox, "spanx, growx, wrap rel"); //// Hide very similar thrust curves - hideSimilarBox = new JCheckBox("Hide very similar thrust curves"); + hideSimilarBox = new JCheckBox(trans.get("TCMotorSelPan.checkbox.hideSimilar")); GUIUtil.changeFontSize(hideSimilarBox, -1); hideSimilarBox.setSelected(Prefs.getBoolean(Prefs.MOTOR_HIDE_SIMILAR, true)); hideSimilarBox.addActionListener(new ActionListener() { @@ -295,7 +298,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec // Motor mount diameter label //// Motor mount diameter: - label = new StyledLabel("Motor mount diameter: " + + label = new StyledLabel(trans.get("TCMotorSelPan.lbl.Motormountdia")+ " " + UnitGroup.UNITS_MOTOR_DIMENSIONS.getDefaultUnit().toStringUnit(diameter)); panel.add(label, "gapright 30lp, spanx, split"); @@ -303,7 +306,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec // Search field //// Search: - label = new StyledLabel("Search:"); + label = new StyledLabel(trans.get("TCMotorSelPan.lbl.Search")); panel.add(label, ""); searchField = new JTextField(); @@ -351,7 +354,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec // Thrust curve selection //// Select thrust curve: - curveSelectionLabel = new JLabel("Select thrust curve:"); + curveSelectionLabel = new JLabel(trans.get("TCMotorSelPan.lbl.Selectthrustcurve")); panel.add(curveSelectionLabel); curveSelectionModel = new DefaultComboBoxModel(); @@ -373,7 +376,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec // Ejection charge delay: - panel.add(new JLabel("Ejection charge delay:")); + panel.add(new JLabel(trans.get("TCMotorSelPan.lbl.Ejectionchargedelay"))); delayBox = new JComboBox(); delayBox.setEditable(true); @@ -382,7 +385,8 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox) e.getSource(); String sel = (String) cb.getSelectedItem(); - if (sel.equalsIgnoreCase("None")) { + //// None + if (sel.equalsIgnoreCase(trans.get("TCMotorSelPan.equalsIgnoreCase.None"))) { selectedDelay = Motor.PLUGGED; } else { try { @@ -395,7 +399,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec }); panel.add(delayBox, "growx, wrap rel"); //// (Number of seconds or \"None\") - panel.add(new StyledLabel("(Number of seconds or \"None\")", -3), "skip, wrap para"); + panel.add(new StyledLabel(trans.get("TCMotorSelPan.lbl.NumberofsecondsorNone"), -3), "skip, wrap para"); setDelays(false); @@ -405,43 +409,43 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec // Thrust curve info //// Total impulse: - panel.add(new JLabel("Total impulse:")); + panel.add(new JLabel(trans.get("TCMotorSelPan.lbl.Totalimpulse"))); totalImpulseLabel = new JLabel(); panel.add(totalImpulseLabel, "wrap"); //// Avg. thrust: - panel.add(new JLabel("Avg. thrust:")); + panel.add(new JLabel(trans.get("TCMotorSelPan.lbl.Avgthrust"))); avgThrustLabel = new JLabel(); panel.add(avgThrustLabel, "wrap"); //// Max. thrust: - panel.add(new JLabel("Max. thrust:")); + panel.add(new JLabel(trans.get("TCMotorSelPan.lbl.Maxthrust"))); maxThrustLabel = new JLabel(); panel.add(maxThrustLabel, "wrap"); //// Burn time: - panel.add(new JLabel("Burn time:")); + panel.add(new JLabel(trans.get("TCMotorSelPan.lbl.Burntime"))); burnTimeLabel = new JLabel(); panel.add(burnTimeLabel, "wrap"); //// Launch mass: - panel.add(new JLabel("Launch mass:")); + panel.add(new JLabel(trans.get("TCMotorSelPan.lbl.Launchmass"))); launchMassLabel = new JLabel(); panel.add(launchMassLabel, "wrap"); //// Empty mass: - panel.add(new JLabel("Empty mass:")); + panel.add(new JLabel(trans.get("TCMotorSelPan.lbl.Emptymass"))); emptyMassLabel = new JLabel(); panel.add(emptyMassLabel, "wrap"); //// Data points: - panel.add(new JLabel("Data points:")); + panel.add(new JLabel(trans.get("TCMotorSelPan.lbl.Datapoints"))); dataPointsLabel = new JLabel(); panel.add(dataPointsLabel, "wrap para"); if (System.getProperty("openrocket.debug.motordigest") != null) { //// Digest: - panel.add(new JLabel("Digest:")); + panel.add(new JLabel(trans.get("TCMotorSelPan.lbl.Digest"))); digestLabel = new JLabel(); panel.add(digestLabel, "w :300:, wrap para"); } else { @@ -482,7 +486,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec changeLabelFont(plot.getDomainAxis(), -2); //// Thrust curve: - chart.setTitle(new TextTitle("Thrust curve:", this.getFont())); + chart.setTitle(new TextTitle(trans.get("TCMotorSelPan.title.Thrustcurve"), this.getFont())); chart.setBackgroundPaint(this.getBackground()); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); @@ -697,7 +701,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec ThrustCurveMotor m = motors.get(i); //// Thrust - XYSeries series = new XYSeries("Thrust"); + XYSeries series = new XYSeries(trans.get("TCMotorSelPan.title.Thrust")); double[] time = m.getTimePoints(); double[] thrust = m.getThrustPoints(); @@ -745,6 +749,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec private void setComment(String s) { s = s.trim(); if (s.length() == 0) { + //// No description available. comment.setText("No description available."); comment.setFont(noCommentFont); comment.setForeground(NO_COMMENT_COLOR); @@ -832,7 +837,8 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec private void setDelays(boolean reset) { if (selectedMotor == null) { - delayBox.setModel(new DefaultComboBoxModel(new String[] { "None" })); + //// None + delayBox.setModel(new DefaultComboBoxModel(new String[] { trans.get("TCMotorSelPan.delayBox.None") })); delayBox.setSelectedIndex(0); } else { @@ -842,7 +848,8 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec double currentDelay = selectedDelay; // Store current setting locally for (int i = 0; i < delays.size(); i++) { - delayStrings[i] = ThrustCurveMotor.getDelayString(delays.get(i), "None"); + //// None + delayStrings[i] = ThrustCurveMotor.getDelayString(delays.get(i), trans.get("TCMotorSelPan.delayBox.None")); } delayBox.setModel(new DefaultComboBoxModel(delayStrings)); @@ -858,7 +865,8 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec } if (!Double.isNaN(closest)) { selectedDelay = closest; - delayBox.setSelectedItem(ThrustCurveMotor.getDelayString(closest, "None")); + //// None + delayBox.setSelectedItem(ThrustCurveMotor.getDelayString(closest, trans.get("TCMotorSelPan.delayBox.None"))); } else { delayBox.setSelectedItem("None"); } @@ -866,7 +874,8 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec } else { selectedDelay = currentDelay; - delayBox.setSelectedItem(ThrustCurveMotor.getDelayString(currentDelay, "None")); + //// None + delayBox.setSelectedItem(ThrustCurveMotor.getDelayString(currentDelay, trans.get("TCMotorSelPan.delayBox.None"))); } diff --git a/src/net/sf/openrocket/gui/dialogs/preferences/PreferencesDialog.java b/src/net/sf/openrocket/gui/dialogs/preferences/PreferencesDialog.java index 04654de8..65a09aa8 100644 --- a/src/net/sf/openrocket/gui/dialogs/preferences/PreferencesDialog.java +++ b/src/net/sf/openrocket/gui/dialogs/preferences/PreferencesDialog.java @@ -101,12 +101,20 @@ public class PreferencesDialog extends JDialog { //// Position to insert new body components: panel.add(new JLabel(trans.get("pref.dlg.lbl.Positiontoinsert")), "gapright para"); panel.add(new JComboBox(new PrefChoiseSelector(Prefs.BODY_COMPONENT_INSERT_POSITION_KEY, - "Always ask", "Insert in middle", "Add to end")), "wrap para, growx, sg combos"); + //// Always ask + //// Insert in middle + //// Add to end + trans.get("pref.dlg.PrefChoiseSelector1"), + trans.get("pref.dlg.PrefChoiseSelector2"), + trans.get("pref.dlg.PrefChoiseSelector3"))), "wrap para, growx, sg combos"); //// Confirm deletion of simulations: panel.add(new JLabel(trans.get("pref.dlg.lbl.Confirmdeletion"))); panel.add(new JComboBox(new PrefBooleanSelector(Prefs.CONFIRM_DELETE_SIMULATION, - "Delete", "Confirm", true)), "wrap 40lp, growx, sg combos"); + //// Delete + //// Confirm + trans.get("pref.dlg.PrefBooleanSelector1"), + trans.get("pref.dlg.PrefBooleanSelector2"), true)), "wrap 40lp, growx, sg combos"); //// User-defined thrust curves: panel.add(new JLabel(trans.get("pref.dlg.lbl.User-definedthrust")), "spanx, wrap"); @@ -177,7 +185,8 @@ public class PreferencesDialog extends JDialog { chooser.setCurrentDirectory(defaultDirectory); } - int returnVal = chooser.showDialog(PreferencesDialog.this, "Add"); + //// Add + int returnVal = chooser.showDialog(PreferencesDialog.this, trans.get("pref.dlg.Add")); if (returnVal == JFileChooser.APPROVE_OPTION) { log.user("Adding user thrust curve: " + chooser.getSelectedFile()); defaultDirectory = chooser.getCurrentDirectory(); @@ -205,9 +214,8 @@ public class PreferencesDialog extends JDialog { }); panel.add(button, "wrap"); - DescriptionArea desc = new DescriptionArea("Add directories, RASP motor files (*.eng), " + - "RockSim engine files (*.rse) or ZIP archives separated by a semicolon (;) to load external " + - "thrust curves. Changes will take effect the next time you start OpenRocket.", 3, -3, false); + //// Add directories, RASP motor files (*.eng), RockSim engine files (*.rse) or ZIP archives separated by a semicolon (;) to load external thrust curves. Changes will take effect the next time you start OpenRocket. + DescriptionArea desc = new DescriptionArea(trans.get("pref.dlg.DescriptionArea.Adddirectories"), 3, -3, false); desc.setBackground(getBackground()); panel.add(desc, "spanx, growx, wrap 40lp"); diff --git a/src/net/sf/openrocket/gui/figureelements/RocketInfo.java b/src/net/sf/openrocket/gui/figureelements/RocketInfo.java index 4832c61f..2237fa39 100644 --- a/src/net/sf/openrocket/gui/figureelements/RocketInfo.java +++ b/src/net/sf/openrocket/gui/figureelements/RocketInfo.java @@ -143,15 +143,19 @@ public class RocketInfo implements FigureElement { private void drawMainInfo() { GlyphVector name = createText(configuration.getRocket().getName()); GlyphVector lengthLine = createText( - "Length " + UnitGroup.UNITS_LENGTH.getDefaultUnit().toStringUnit(length) + - ", max. diameter " + + //// Length + trans.get("RocketInfo.lengthLine.Length") +" " + UnitGroup.UNITS_LENGTH.getDefaultUnit().toStringUnit(length) + + //// , max. diameter + trans.get("RocketInfo.lengthLine.maxdiameter") +" " + UnitGroup.UNITS_LENGTH.getDefaultUnit().toStringUnit(diameter)); String massText; if (configuration.hasMotors()) - massText = "Mass with motors "; + //// Mass with motors + massText = trans.get("RocketInfo.massText1") +" "; else - massText = "Mass with no motors "; + //// Mass with no motors + massText = trans.get("RocketInfo.massText2") +" "; massText += UnitGroup.UNITS_MASS.getDefaultUnit().toStringUnit(mass); @@ -169,8 +173,8 @@ public class RocketInfo implements FigureElement { private void drawStabilityInfo() { String at; - - at = "at M="+UnitGroup.UNITS_COEFFICIENT.getDefaultUnit().toStringUnit(mach); + //// at M= + at = trans.get("RocketInfo.at")+UnitGroup.UNITS_COEFFICIENT.getDefaultUnit().toStringUnit(mach); if (!Double.isNaN(aoa)) { at += " "+ALPHA+"=" + UnitGroup.UNITS_ANGLE.getDefaultUnit().toStringUnit(aoa); } @@ -184,10 +188,12 @@ public class RocketInfo implements FigureElement { getCp()); GlyphVector stabValue = createText( getStability()); - - GlyphVector cgText = createText("CG: "); - GlyphVector cpText = createText("CP: "); - GlyphVector stabText = createText("Stability: "); + //// CG: + GlyphVector cgText = createText(trans.get("RocketInfo.cgText") +" "); + //// CP: + GlyphVector cpText = createText(trans.get("RocketInfo.cpText") +" "); + //// Stability: + GlyphVector stabText = createText(trans.get("RocketInfo.stabText") + " "); GlyphVector atText = createSmallText(at); Rectangle2D cgRect = cgValue.getVisualBounds(); @@ -315,7 +321,8 @@ public class RocketInfo implements FigureElement { GlyphVector[] texts = new GlyphVector[warnings.size()+1]; double max = 0; - texts[0] = createText("Warning:"); + //// Warning: + texts[0] = createText(trans.get("RocketInfo.Warning")); int i=1; for (Warning w: warnings) { texts[i] = createText(w.toString()); @@ -344,7 +351,8 @@ public class RocketInfo implements FigureElement { double height = drawFlightData(); if (calculatingData) { - GlyphVector calculating = createText("Calculating..."); + //// Calculating... + GlyphVector calculating = createText(trans.get("RocketInfo.Calculating")); g2.setColor(Color.BLACK); g2.drawGlyphVector(calculating, x1, (float)(y2-height)); } @@ -357,30 +365,37 @@ public class RocketInfo implements FigureElement { double width=0; - GlyphVector apogee = createText("Apogee: "); - GlyphVector maxVelocity = createText("Max. velocity: "); - GlyphVector maxAcceleration = createText("Max. acceleration: "); + //// Apogee: + GlyphVector apogee = createText(trans.get("RocketInfo.Apogee")+" "); + //// Max. velocity: + GlyphVector maxVelocity = createText(trans.get("RocketInfo.Maxvelocity") +" "); + //// Max. acceleration: + GlyphVector maxAcceleration = createText(trans.get("RocketInfo.Maxacceleration") + " "); GlyphVector apogeeValue, velocityValue, accelerationValue; if (!Double.isNaN(flightData.getMaxAltitude())) { apogeeValue = createText( UnitGroup.UNITS_DISTANCE.toStringUnit(flightData.getMaxAltitude())); } else { - apogeeValue = createText("N/A"); + //// N/A + apogeeValue = createText(trans.get("RocketInfo.apogeeValue")); } if (!Double.isNaN(flightData.getMaxVelocity())) { velocityValue = createText( UnitGroup.UNITS_VELOCITY.toStringUnit(flightData.getMaxVelocity()) + - " (Mach " + + //// (Mach + " " +trans.get("RocketInfo.Mach") +" " + UnitGroup.UNITS_COEFFICIENT.toString(flightData.getMaxMachNumber()) + ")"); } else { - velocityValue = createText("N/A"); + //// N/A + velocityValue = createText(trans.get("RocketInfo.velocityValue")); } if (!Double.isNaN(flightData.getMaxAcceleration())) { accelerationValue = createText( UnitGroup.UNITS_ACCELERATION.toStringUnit(flightData.getMaxAcceleration())); } else { - accelerationValue = createText("N/A"); + //// N/A + accelerationValue = createText(trans.get("RocketInfo.accelerationValue")); } Rectangle2D rect; diff --git a/src/net/sf/openrocket/gui/main/BasicFrame.java b/src/net/sf/openrocket/gui/main/BasicFrame.java index 63fbc9e5..966354bf 100644 --- a/src/net/sf/openrocket/gui/main/BasicFrame.java +++ b/src/net/sf/openrocket/gui/main/BasicFrame.java @@ -1146,10 +1146,13 @@ public class BasicFrame extends JFrame { log.info("Warnings while reading file: " + warnings); WarningDialog.showWarnings(parent, new Object[] { - "The following problems were encountered while opening " + filename + ".", - "Some design features may not have been loaded correctly." + //// The following problems were encountered while opening + trans.get("BasicFrame.WarningDialog.txt1") +" " + filename + ".", + //// Some design features may not have been loaded correctly. + trans.get("BasicFrame.WarningDialog.txt2") }, - "Warnings while opening file", warnings); + //// Warnings while opening file + trans.get("BasicFrame.WarningDialog.title"), warnings); } @@ -1357,7 +1360,8 @@ public class BasicFrame extends JFrame { Rocket rocket = new Rocket(); Stage stage = new Stage(); - stage.setName("Sustainer"); + //// Sustainer + stage.setName(trans.get("BasicFrame.StageName.Sustainer")); rocket.addChild(stage); OpenRocketDocument doc = new OpenRocketDocument(rocket); doc.setSaved(true); diff --git a/src/net/sf/openrocket/gui/main/ComponentIcons.java b/src/net/sf/openrocket/gui/main/ComponentIcons.java index d1e47a30..82257718 100644 --- a/src/net/sf/openrocket/gui/main/ComponentIcons.java +++ b/src/net/sf/openrocket/gui/main/ComponentIcons.java @@ -9,6 +9,7 @@ import javax.imageio.ImageIO; import javax.swing.Icon; import javax.swing.ImageIcon; +import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.rocketcomponent.BodyTube; import net.sf.openrocket.rocketcomponent.Bulkhead; import net.sf.openrocket.rocketcomponent.CenteringRing; @@ -25,10 +26,12 @@ import net.sf.openrocket.rocketcomponent.Streamer; import net.sf.openrocket.rocketcomponent.Transition; import net.sf.openrocket.rocketcomponent.TrapezoidFinSet; import net.sf.openrocket.rocketcomponent.TubeCoupler; +import net.sf.openrocket.startup.Application; public class ComponentIcons { - + private static final Translator trans = Application.getTranslator(); + private static final String ICON_DIRECTORY = "pix/componenticons/"; private static final String SMALL_SUFFIX = "-small.png"; private static final String LARGE_SUFFIX = "-large.png"; @@ -41,22 +44,38 @@ public class ComponentIcons { new HashMap,ImageIcon>(); static { - load("nosecone", "Nose cone", NoseCone.class); - load("bodytube", "Body tube", BodyTube.class); - load("transition", "Transition", Transition.class); - load("trapezoidfin", "Trapezoidal fin set", TrapezoidFinSet.class); - load("ellipticalfin", "Elliptical fin set", EllipticalFinSet.class); - load("freeformfin", "Freeform fin set", FreeformFinSet.class); - load("launchlug", "Launch lug", LaunchLug.class); - load("innertube", "Inner tube", InnerTube.class); - load("tubecoupler", "Tube coupler", TubeCoupler.class); - load("centeringring", "Centering ring", CenteringRing.class); - load("bulkhead", "Bulk head", Bulkhead.class); - load("engineblock", "Engine block", EngineBlock.class); - load("parachute", "Parachute", Parachute.class); - load("streamer", "Streamer", Streamer.class); - load("shockcord", "Shock cord", ShockCord.class); - load("mass", "Mass component", MassComponent.class); + //// Nose cone + load("nosecone", trans.get("ComponentIcons.Nosecone"), NoseCone.class); + //// Body tube + load("bodytube", trans.get("ComponentIcons.Bodytube"), BodyTube.class); + //// Transition + load("transition", trans.get("ComponentIcons.Transition"), Transition.class); + //// Trapezoidal fin set + load("trapezoidfin", trans.get("ComponentIcons.Trapezoidalfinset"), TrapezoidFinSet.class); + //// Elliptical fin set + load("ellipticalfin", trans.get("ComponentIcons.Ellipticalfinset"), EllipticalFinSet.class); + //// Freeform fin set + load("freeformfin", trans.get("ComponentIcons.Freeformfinset"), FreeformFinSet.class); + //// Launch lug + load("launchlug", trans.get("ComponentIcons.Launchlug"), LaunchLug.class); + //// Inner tube + load("innertube", trans.get("ComponentIcons.Innertube"), InnerTube.class); + //// Tube coupler + load("tubecoupler", trans.get("ComponentIcons.Tubecoupler"), TubeCoupler.class); + //// Centering ring + load("centeringring", trans.get("ComponentIcons.Centeringring"), CenteringRing.class); + //// Bulk head + load("bulkhead", trans.get("ComponentIcons.Bulkhead"), Bulkhead.class); + //// Engine block + load("engineblock", trans.get("ComponentIcons.Engineblock"), EngineBlock.class); + //// Parachute + load("parachute", trans.get("ComponentIcons.Parachute"), Parachute.class); + //// Streamer + load("streamer", trans.get("ComponentIcons.Streamer"), Streamer.class); + //// Shock cord + load("shockcord", trans.get("ComponentIcons.Shockcord"), ShockCord.class); + //// Mass component + load("mass", trans.get("ComponentIcons.Masscomponent"), MassComponent.class); } private static void load(String filename, String name, Class componentClass) { @@ -133,7 +152,8 @@ public class ComponentIcons { } - icons[1] = new ImageIcon(bi2,desc + " (disabled)"); + //// (disabled) + icons[1] = new ImageIcon(bi2,desc + " " +trans.get("ComponentIcons.disabled")); return icons; } else { diff --git a/src/net/sf/openrocket/gui/main/SimulationEditDialog.java b/src/net/sf/openrocket/gui/main/SimulationEditDialog.java index ed9bbede..501f79b0 100644 --- a/src/net/sf/openrocket/gui/main/SimulationEditDialog.java +++ b/src/net/sf/openrocket/gui/main/SimulationEditDialog.java @@ -547,18 +547,25 @@ public class SimulationEditDialog extends JDialog { private String getIntensityDescription(double i) { if (i < 0.001) - return "None"; + //// None + return trans.get("simedtdlg.IntensityDesc.None"); if (i < 0.05) - return "Very low"; + //// Very low + return trans.get("simedtdlg.IntensityDesc.Verylow"); if (i < 0.10) - return "Low"; + //// Low + return trans.get("simedtdlg.IntensityDesc.Low"); if (i < 0.15) - return "Medium"; + //// Medium + return trans.get("simedtdlg.IntensityDesc.Medium"); if (i < 0.20) - return "High"; + //// High + return trans.get("simedtdlg.IntensityDesc.High"); if (i < 0.25) - return "Very high"; - return "Extreme"; + //// Very high + return trans.get("simedtdlg.IntensityDesc.Veryhigh"); + //// Extreme + return trans.get("simedtdlg.IntensityDesc.Extreme"); } diff --git a/src/net/sf/openrocket/gui/plot/PlotConfiguration.java b/src/net/sf/openrocket/gui/plot/PlotConfiguration.java index 2fd10d2b..93122736 100644 --- a/src/net/sf/openrocket/gui/plot/PlotConfiguration.java +++ b/src/net/sf/openrocket/gui/plot/PlotConfiguration.java @@ -26,7 +26,7 @@ public class PlotConfiguration implements Cloneable { PlotConfiguration config; //// Vertical motion vs. time - config = new PlotConfiguration("Vertical motion vs. time"); + config = new PlotConfiguration(trans.get("PlotConfiguration.Verticalmotion")); config.addPlotDataType(FlightDataType.TYPE_ALTITUDE, 0); config.addPlotDataType(FlightDataType.TYPE_VELOCITY_Z); config.addPlotDataType(FlightDataType.TYPE_ACCELERATION_Z); @@ -39,7 +39,7 @@ public class PlotConfiguration implements Cloneable { configs.add(config); //// Total motion vs. time - config = new PlotConfiguration("Total motion vs. time"); + config = new PlotConfiguration(trans.get("PlotConfiguration.Totalmotion")); config.addPlotDataType(FlightDataType.TYPE_ALTITUDE, 0); config.addPlotDataType(FlightDataType.TYPE_VELOCITY_TOTAL); config.addPlotDataType(FlightDataType.TYPE_ACCELERATION_TOTAL); @@ -52,7 +52,7 @@ public class PlotConfiguration implements Cloneable { configs.add(config); //// Flight side profile - config = new PlotConfiguration("Flight side profile", FlightDataType.TYPE_POSITION_X); + config = new PlotConfiguration(trans.get("PlotConfiguration.Flightside"), FlightDataType.TYPE_POSITION_X); config.addPlotDataType(FlightDataType.TYPE_ALTITUDE); config.setEvent(FlightEvent.Type.IGNITION, true); config.setEvent(FlightEvent.Type.BURNOUT, true); diff --git a/src/net/sf/openrocket/gui/plot/SimulationPlotPanel.java b/src/net/sf/openrocket/gui/plot/SimulationPlotPanel.java index 1cc0c788..eb646dc5 100644 --- a/src/net/sf/openrocket/gui/plot/SimulationPlotPanel.java +++ b/src/net/sf/openrocket/gui/plot/SimulationPlotPanel.java @@ -41,11 +41,15 @@ public class SimulationPlotPanel extends JPanel { public static final int LEFT = 0; public static final int RIGHT = 1; - public static final String AUTO_NAME = "Auto"; - public static final String LEFT_NAME = "Left"; - public static final String RIGHT_NAME = "Right"; + //// Auto + public static final String AUTO_NAME = trans.get("simplotpanel.AUTO_NAME"); + //// Left + public static final String LEFT_NAME = trans.get("simplotpanel.LEFT_NAME"); + //// Right + public static final String RIGHT_NAME = trans.get("simplotpanel.RIGHT_NAME"); - private static final String CUSTOM = "Custom"; + //// Custom + private static final String CUSTOM = trans.get("simplotpanel.CUSTOM"); /** The "Custom" configuration - not to be used for anything other than the title. */ private static final PlotConfiguration CUSTOM_CONFIGURATION; diff --git a/src/net/sf/openrocket/rocketcomponent/BodyTube.java b/src/net/sf/openrocket/rocketcomponent/BodyTube.java index f45f3526..297ec1c3 100644 --- a/src/net/sf/openrocket/rocketcomponent/BodyTube.java +++ b/src/net/sf/openrocket/rocketcomponent/BodyTube.java @@ -1,6 +1,8 @@ package net.sf.openrocket.rocketcomponent; +import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.motor.Motor; +import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.MathUtil; @@ -16,7 +18,8 @@ import java.util.HashMap; */ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial { - + private static final Translator trans = Application.getTranslator(); + private double radius = 0; private boolean autoRadius = false; // Radius chosen automatically based on parent component @@ -199,7 +202,8 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial */ @Override public String getComponentName() { - return "Body tube"; + //// Body tube + return trans.get("BodyTube.BodyTube"); } /** diff --git a/src/net/sf/openrocket/rocketcomponent/Bulkhead.java b/src/net/sf/openrocket/rocketcomponent/Bulkhead.java index 4c0e6c0e..88e2130f 100644 --- a/src/net/sf/openrocket/rocketcomponent/Bulkhead.java +++ b/src/net/sf/openrocket/rocketcomponent/Bulkhead.java @@ -1,8 +1,12 @@ package net.sf.openrocket.rocketcomponent; +import net.sf.openrocket.l10n.Translator; +import net.sf.openrocket.startup.Application; + public class Bulkhead extends RadiusRingComponent { - + private static final Translator trans = Application.getTranslator(); + public Bulkhead() { setOuterRadiusAutomatic(true); setLength(0.002); @@ -25,7 +29,8 @@ public class Bulkhead extends RadiusRingComponent { @Override public String getComponentName() { - return "Bulkhead"; + //// Bulkhead + return trans.get("Bulkhead.Bulkhead"); } @Override diff --git a/src/net/sf/openrocket/rocketcomponent/ExternalComponent.java b/src/net/sf/openrocket/rocketcomponent/ExternalComponent.java index 6fa4a4c2..0f19b430 100644 --- a/src/net/sf/openrocket/rocketcomponent/ExternalComponent.java +++ b/src/net/sf/openrocket/rocketcomponent/ExternalComponent.java @@ -2,7 +2,9 @@ package net.sf.openrocket.rocketcomponent; import java.util.List; +import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.material.Material; +import net.sf.openrocket.startup.Application; import net.sf.openrocket.unit.UnitGroup; import net.sf.openrocket.util.Prefs; @@ -17,11 +19,16 @@ import net.sf.openrocket.util.Prefs; public abstract class ExternalComponent extends RocketComponent { public enum Finish { - ROUGH("Rough", 500e-6), - UNFINISHED("Unfinished", 150e-6), - NORMAL("Regular paint", 60e-6), - SMOOTH("Smooth paint", 20e-6), - POLISHED("Polished", 2e-6); + //// Rough + ROUGH("ExternalComponent.Rough", 500e-6), + //// Unfinished + UNFINISHED("ExternalComponent.Unfinished", 150e-6), + //// Regular paint + NORMAL("ExternalComponent.Regularpaint", 60e-6), + //// Smooth paint + SMOOTH("ExternalComponent.Smoothpaint", 20e-6), + //// Polished + POLISHED("ExternalComponent.Polished", 2e-6); private final String name; private final double roughnessSize; @@ -37,7 +44,8 @@ public abstract class ExternalComponent extends RocketComponent { @Override public String toString() { - return name + " (" + UnitGroup.UNITS_ROUGHNESS.toStringUnit(roughnessSize) + ")"; + final Translator trans = Application.getTranslator(); + return trans.get(name) + " (" + UnitGroup.UNITS_ROUGHNESS.toStringUnit(roughnessSize) + ")"; } } diff --git a/src/net/sf/openrocket/rocketcomponent/FinSet.java b/src/net/sf/openrocket/rocketcomponent/FinSet.java index 8d6a77f4..d218ba68 100644 --- a/src/net/sf/openrocket/rocketcomponent/FinSet.java +++ b/src/net/sf/openrocket/rocketcomponent/FinSet.java @@ -5,13 +5,16 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; +import net.sf.openrocket.l10n.Translator; +import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.MathUtil; import net.sf.openrocket.util.Transformation; public abstract class FinSet extends ExternalComponent { - + private static final Translator trans = Application.getTranslator(); + /** * Maximum allowed cant of fins. */ @@ -19,9 +22,12 @@ public abstract class FinSet extends ExternalComponent { public enum CrossSection { - SQUARE("Square", 1.00), - ROUNDED("Rounded", 0.99), - AIRFOIL("Airfoil", 0.85); + //// Square + SQUARE(trans.get("FinSet.CrossSection.SQUARE"), 1.00), + //// Rounded + ROUNDED(trans.get("FinSet.CrossSection.ROUNDED"), 0.99), + //// Airfoil + AIRFOIL(trans.get("FinSet.CrossSection.AIRFOIL"), 0.85); private final String name; private final double volume; @@ -42,9 +48,12 @@ public abstract class FinSet extends ExternalComponent { } public enum TabRelativePosition { - FRONT("Root chord leading edge"), - CENTER("Root chord midpoint"), - END("Root chord trailing edge"); + //// Root chord leading edge + FRONT(trans.get("FinSet.TabRelativePosition.FRONT")), + //// Root chord midpoint + CENTER(trans.get("FinSet.TabRelativePosition.CENTER")), + //// Root chord trailing edge + END(trans.get("FinSet.TabRelativePosition.END")); private final String name; diff --git a/src/net/sf/openrocket/rocketcomponent/FreeformFinSet.java b/src/net/sf/openrocket/rocketcomponent/FreeformFinSet.java index 24ca9811..cdbb7c3e 100644 --- a/src/net/sf/openrocket/rocketcomponent/FreeformFinSet.java +++ b/src/net/sf/openrocket/rocketcomponent/FreeformFinSet.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.logging.LogHelper; import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.ArrayList; @@ -13,7 +14,8 @@ import net.sf.openrocket.util.Coordinate; public class FreeformFinSet extends FinSet { private static final LogHelper log = Application.getLogger(); - + private static final Translator trans = Application.getTranslator(); + private ArrayList points = new ArrayList(); public FreeformFinSet() { @@ -303,7 +305,8 @@ public class FreeformFinSet extends FinSet { @Override public String getComponentName() { - return "Freeform fin set"; + //// Freeform fin set + return trans.get("FreeformFinSet.FreeformFinSet"); } diff --git a/src/net/sf/openrocket/rocketcomponent/InnerTube.java b/src/net/sf/openrocket/rocketcomponent/InnerTube.java index 036daef6..448da154 100644 --- a/src/net/sf/openrocket/rocketcomponent/InnerTube.java +++ b/src/net/sf/openrocket/rocketcomponent/InnerTube.java @@ -1,6 +1,8 @@ package net.sf.openrocket.rocketcomponent; +import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.motor.Motor; +import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.MathUtil; @@ -18,7 +20,8 @@ import java.util.List; */ public class InnerTube extends ThicknessRingComponent implements Clusterable, RadialParent, MotorMount { - + private static final Translator trans = Application.getTranslator(); + private ClusterConfiguration cluster = ClusterConfiguration.SINGLE; private double clusterScale = 1.0; private double clusterRotation = 0.0; @@ -57,7 +60,8 @@ public class InnerTube extends ThicknessRingComponent @Override public String getComponentName() { - return "Inner Tube"; + //// Inner Tube + return trans.get("InnerTube.InnerTube"); } @Override diff --git a/src/net/sf/openrocket/rocketcomponent/LaunchLug.java b/src/net/sf/openrocket/rocketcomponent/LaunchLug.java index a51629a3..f61ce7ed 100644 --- a/src/net/sf/openrocket/rocketcomponent/LaunchLug.java +++ b/src/net/sf/openrocket/rocketcomponent/LaunchLug.java @@ -1,5 +1,7 @@ package net.sf.openrocket.rocketcomponent; +import net.sf.openrocket.l10n.Translator; +import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.MathUtil; @@ -10,6 +12,8 @@ import java.util.Collection; public class LaunchLug extends ExternalComponent implements Coaxial { + private static final Translator trans = Application.getTranslator(); + private double radius; private double thickness; @@ -169,7 +173,8 @@ public class LaunchLug extends ExternalComponent implements Coaxial { @Override public String getComponentName() { - return "Launch lug"; + //// Launch lug + return trans.get("LaunchLug.Launchlug"); } @Override diff --git a/src/net/sf/openrocket/rocketcomponent/MassComponent.java b/src/net/sf/openrocket/rocketcomponent/MassComponent.java index 0a84e3fe..47911aa0 100644 --- a/src/net/sf/openrocket/rocketcomponent/MassComponent.java +++ b/src/net/sf/openrocket/rocketcomponent/MassComponent.java @@ -1,8 +1,12 @@ package net.sf.openrocket.rocketcomponent; +import net.sf.openrocket.l10n.Translator; +import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.MathUtil; public class MassComponent extends MassObject { + private static final Translator trans = Application.getTranslator(); + private double mass = 0; @@ -32,7 +36,8 @@ public class MassComponent extends MassObject { @Override public String getComponentName() { - return "Mass component"; + //// Mass component + return trans.get("MassComponent.MassComponent"); } @Override diff --git a/src/net/sf/openrocket/rocketcomponent/MotorMount.java b/src/net/sf/openrocket/rocketcomponent/MotorMount.java index d7ea658f..15ea70f8 100644 --- a/src/net/sf/openrocket/rocketcomponent/MotorMount.java +++ b/src/net/sf/openrocket/rocketcomponent/MotorMount.java @@ -1,14 +1,18 @@ package net.sf.openrocket.rocketcomponent; +import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.motor.Motor; import net.sf.openrocket.simulation.FlightEvent; +import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.ChangeSource; import net.sf.openrocket.util.Coordinate; public interface MotorMount extends ChangeSource { - + static final Translator trans = Application.getTranslator(); + public static enum IgnitionEvent { - AUTOMATIC("Automatic (launch or ejection charge)") { + //// Automatic (launch or ejection charge) + AUTOMATIC(trans.get("MotorMount.IgnitionEvent.AUTOMATIC")) { @Override public boolean isActivationEvent(FlightEvent e, RocketComponent source) { int count = source.getRocket().getStageCount(); @@ -21,13 +25,15 @@ public interface MotorMount extends ChangeSource { } } }, - LAUNCH("Launch") { + //// Launch + LAUNCH(trans.get("MotorMount.IgnitionEvent.LAUNCH")) { @Override public boolean isActivationEvent(FlightEvent e, RocketComponent source) { return (e.getType() == FlightEvent.Type.LAUNCH); } }, - EJECTION_CHARGE("First ejection charge of previous stage") { + //// First ejection charge of previous stage + EJECTION_CHARGE(trans.get("MotorMount.IgnitionEvent.EJECTION_CHARGE")) { @Override public boolean isActivationEvent(FlightEvent e, RocketComponent source) { if (e.getType() != FlightEvent.Type.EJECTION_CHARGE) @@ -38,7 +44,8 @@ public interface MotorMount extends ChangeSource { return (mount+1 == charge); } }, - BURNOUT("First burnout of previous stage") { + //// First burnout of previous stage + BURNOUT(trans.get("MotorMount.IgnitionEvent.BURNOUT")) { @Override public boolean isActivationEvent(FlightEvent e, RocketComponent source) { if (e.getType() != FlightEvent.Type.BURNOUT) @@ -49,7 +56,8 @@ public interface MotorMount extends ChangeSource { return (mount+1 == charge); } }, - NEVER("Never") { + //// Never + NEVER(trans.get("MotorMount.IgnitionEvent.NEVER")) { @Override public boolean isActivationEvent(FlightEvent e, RocketComponent source) { return false; diff --git a/src/net/sf/openrocket/rocketcomponent/NoseCone.java b/src/net/sf/openrocket/rocketcomponent/NoseCone.java index 1aa61a4c..c271e2d4 100644 --- a/src/net/sf/openrocket/rocketcomponent/NoseCone.java +++ b/src/net/sf/openrocket/rocketcomponent/NoseCone.java @@ -1,5 +1,8 @@ package net.sf.openrocket.rocketcomponent; +import net.sf.openrocket.l10n.Translator; +import net.sf.openrocket.startup.Application; + /** * Rocket nose cones of various types. Implemented as a transition with the * fore radius == 0. @@ -8,7 +11,8 @@ package net.sf.openrocket.rocketcomponent; */ public class NoseCone extends Transition { - + private static final Translator trans = Application.getTranslator(); + /********* Constructors **********/ public NoseCone() { @@ -112,7 +116,8 @@ public class NoseCone extends Transition { */ @Override public String getComponentName() { - return "Nose cone"; + //// Nose cone + return trans.get("NoseCone.NoseCone"); } /** diff --git a/src/net/sf/openrocket/rocketcomponent/Parachute.java b/src/net/sf/openrocket/rocketcomponent/Parachute.java index 080ab635..0ce768f9 100644 --- a/src/net/sf/openrocket/rocketcomponent/Parachute.java +++ b/src/net/sf/openrocket/rocketcomponent/Parachute.java @@ -1,11 +1,14 @@ package net.sf.openrocket.rocketcomponent; +import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.material.Material; +import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.MathUtil; import net.sf.openrocket.util.Prefs; public class Parachute extends RecoveryDevice { - + private static final Translator trans = Application.getTranslator(); + public static final double DEFAULT_CD = 0.8; private double diameter; @@ -103,7 +106,8 @@ public class Parachute extends RecoveryDevice { @Override public String getComponentName() { - return "Parachute"; + //// Parachute + return trans.get("Parachute.Parachute"); } @Override diff --git a/src/net/sf/openrocket/rocketcomponent/RecoveryDevice.java b/src/net/sf/openrocket/rocketcomponent/RecoveryDevice.java index e8596511..0c7fe7c4 100644 --- a/src/net/sf/openrocket/rocketcomponent/RecoveryDevice.java +++ b/src/net/sf/openrocket/rocketcomponent/RecoveryDevice.java @@ -1,7 +1,9 @@ package net.sf.openrocket.rocketcomponent; +import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.material.Material; import net.sf.openrocket.simulation.FlightEvent; +import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.MathUtil; import net.sf.openrocket.util.Pair; import net.sf.openrocket.util.Prefs; @@ -20,15 +22,18 @@ import net.sf.openrocket.util.Prefs; * @author Sampo Niskanen */ public abstract class RecoveryDevice extends MassObject { + private static final Translator trans = Application.getTranslator(); public static enum DeployEvent { - LAUNCH("Launch (plus NN seconds)") { + //// Launch (plus NN seconds) + LAUNCH(trans.get("RecoveryDevice.DeployEvent.LAUNCH")) { @Override public boolean isActivationEvent(FlightEvent e, RocketComponent source) { return e.getType() == FlightEvent.Type.LAUNCH; } }, - EJECTION("First ejection charge of this stage") { + //// First ejection charge of this stage + EJECTION(trans.get("RecoveryDevice.DeployEvent.EJECTION")) { @Override public boolean isActivationEvent(FlightEvent e, RocketComponent source) { if (e.getType() != FlightEvent.Type.EJECTION_CHARGE) @@ -37,13 +42,15 @@ public abstract class RecoveryDevice extends MassObject { return charge.getStageNumber() == source.getStageNumber(); } }, - APOGEE("Apogee") { + //// Apogee + APOGEE(trans.get("RecoveryDevice.DeployEvent.APOGEE")) { @Override public boolean isActivationEvent(FlightEvent e, RocketComponent source) { return e.getType() == FlightEvent.Type.APOGEE; } }, - ALTITUDE("Specific altitude during descent") { + //// Specific altitude during descent + ALTITUDE(trans.get("RecoveryDevice.DeployEvent.ALTITUDE")) { @SuppressWarnings("unchecked") @Override public boolean isActivationEvent(FlightEvent e, RocketComponent source) { @@ -56,7 +63,8 @@ public abstract class RecoveryDevice extends MassObject { return (altitude.getU() >= alt) && (altitude.getV() <= alt); } }, - NEVER("Never") { + //// Never + NEVER(trans.get("RecoveryDevice.DeployEvent.NEVER")) { @Override public boolean isActivationEvent(FlightEvent e, RocketComponent source) { return false; diff --git a/src/net/sf/openrocket/rocketcomponent/Rocket.java b/src/net/sf/openrocket/rocketcomponent/Rocket.java index 3a284534..0be57cd1 100644 --- a/src/net/sf/openrocket/rocketcomponent/Rocket.java +++ b/src/net/sf/openrocket/rocketcomponent/Rocket.java @@ -12,6 +12,7 @@ import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; import net.sf.openrocket.gui.main.ExceptionHandler; +import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.logging.LogHelper; import net.sf.openrocket.motor.Motor; import net.sf.openrocket.startup.Application; @@ -34,6 +35,7 @@ import net.sf.openrocket.util.UniqueID; public class Rocket extends RocketComponent { private static final LogHelper log = Application.getLogger(); + private static final Translator trans = Application.getTranslator(); public static final double DEFAULT_REFERENCE_LENGTH = 0.01; @@ -702,7 +704,8 @@ public class Rocket extends RocketComponent { } if (motorCount == 0) { - return "[No motors]"; + //// [No motors] + return trans.get("Rocket.motorCount.Nomotor"); } // Change multiple occurrences of a motor to n x motor @@ -778,7 +781,8 @@ public class Rocket extends RocketComponent { @Override public String getComponentName() { - return "Rocket"; + //// Rocket + return trans.get("Rocket.compname.Rocket"); } @Override diff --git a/src/net/sf/openrocket/rocketcomponent/RocketComponent.java b/src/net/sf/openrocket/rocketcomponent/RocketComponent.java index 8573caa6..b525a47d 100644 --- a/src/net/sf/openrocket/rocketcomponent/RocketComponent.java +++ b/src/net/sf/openrocket/rocketcomponent/RocketComponent.java @@ -10,6 +10,7 @@ import java.util.NoSuchElementException; import javax.swing.event.ChangeListener; +import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.logging.LogHelper; import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.ArrayList; @@ -26,22 +27,28 @@ import net.sf.openrocket.util.UniqueID; public abstract class RocketComponent implements ChangeSource, Cloneable, Iterable, Visitable { private static final LogHelper log = Application.getLogger(); - + private static final Translator trans = Application.getTranslator(); + /* * Text is suitable to the form * Position relative to: */ public enum Position { /** Position relative to the top of the parent component. */ - TOP("Top of the parent component"), + //// Top of the parent component + TOP(trans.get("RocketComponent.Position.TOP")), /** Position relative to the middle of the parent component. */ - MIDDLE("Middle of the parent component"), + //// Middle of the parent component + MIDDLE(trans.get("RocketComponent.Position.MIDDLE")), /** Position relative to the bottom of the parent component. */ - BOTTOM("Bottom of the parent component"), + //// Bottom of the parent component + BOTTOM(trans.get("RocketComponent.Position.BOTTOM")), /** Position after the parent component (for body components). */ - AFTER("After the parent component"), + //// After the parent component + AFTER(trans.get("RocketComponent.Position.AFTER")), /** Specify an absolute X-coordinate position. */ - ABSOLUTE("Tip of the nose cone"); + //// Tip of the nose cone + ABSOLUTE(trans.get("RocketComponent.Position.ABSOLUTE")); private String title; diff --git a/src/net/sf/openrocket/rocketcomponent/ShockCord.java b/src/net/sf/openrocket/rocketcomponent/ShockCord.java index 6a23a75b..719473d8 100644 --- a/src/net/sf/openrocket/rocketcomponent/ShockCord.java +++ b/src/net/sf/openrocket/rocketcomponent/ShockCord.java @@ -1,12 +1,15 @@ package net.sf.openrocket.rocketcomponent; +import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.material.Material; +import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.MathUtil; import net.sf.openrocket.util.Prefs; public class ShockCord extends MassObject { - + private static final Translator trans = Application.getTranslator(); + private Material material; private double cordLength; @@ -52,7 +55,8 @@ public class ShockCord extends MassObject { @Override public String getComponentName() { - return "Shock cord"; + //// Shock cord + return trans.get("ShockCord.ShockCord"); } @Override diff --git a/src/net/sf/openrocket/rocketcomponent/Stage.java b/src/net/sf/openrocket/rocketcomponent/Stage.java index b16cd4b6..b984a2a5 100644 --- a/src/net/sf/openrocket/rocketcomponent/Stage.java +++ b/src/net/sf/openrocket/rocketcomponent/Stage.java @@ -1,10 +1,16 @@ package net.sf.openrocket.rocketcomponent; +import net.sf.openrocket.l10n.Translator; +import net.sf.openrocket.startup.Application; + public class Stage extends ComponentAssembly { + private static final Translator trans = Application.getTranslator(); + @Override public String getComponentName () { - return "Stage"; + //// Stage + return trans.get("Stage.Stage"); } diff --git a/src/net/sf/openrocket/rocketcomponent/Transition.java b/src/net/sf/openrocket/rocketcomponent/Transition.java index 81140a66..09818359 100644 --- a/src/net/sf/openrocket/rocketcomponent/Transition.java +++ b/src/net/sf/openrocket/rocketcomponent/Transition.java @@ -1,5 +1,7 @@ package net.sf.openrocket.rocketcomponent; +import net.sf.openrocket.l10n.Translator; +import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.MathUtil; @@ -33,7 +35,7 @@ public class Transition extends SymmetricComponent { private double aftShoulderThickness; private double aftShoulderLength; private boolean aftShoulderCapped; - + private static final Translator trans = Application.getTranslator(); // Used to cache the clip length private double clipLength = -1; @@ -491,7 +493,8 @@ public class Transition extends SymmetricComponent { */ @Override public String getComponentName() { - return "Transition"; + //// Transition + return trans.get("Transition.Transition"); } @Override @@ -536,9 +539,12 @@ public class Transition extends SymmetricComponent { /** * Conical shape. */ - CONICAL("Conical", - "A conical nose cone has a profile of a triangle.", - "A conical transition has straight sides.") { + //// Conical + CONICAL(trans.get("Shape.Conical"), + //// A conical nose cone has a profile of a triangle. + trans.get("Shape.Conical.desc1"), + //// A conical transition has straight sides. + trans.get("Shape.Conical.desc2")) { @Override public double getRadius(double x, double radius, double length, double param) { assert x >= 0; @@ -553,15 +559,12 @@ public class Transition extends SymmetricComponent { * that will be used. That is, for param==1 a tangent ogive will be produced, and * for smaller values the shape straightens out into a cone at param==0. */ - OGIVE("Ogive", - "An ogive nose cone has a profile that is a segment of a circle. " + - "The shape parameter value 1 produces a <b>tangent ogive</b>, which has " + - "a smooth transition to the body tube, values less than 1 produce " + - "<b>secant ogives</b>.", - "An ogive transition has a profile that is a segment of a circle. " + - "The shape parameter value 1 produces a <b>tangent ogive</b>, which has " + - "a smooth transition to the body tube at the aft end, values less than 1 " + - "produce <b>secant ogives</b>.") { + //// Ogive + OGIVE(trans.get("Shape.Ogive"), + //// An ogive nose cone has a profile that is a segment of a circle. The shape parameter value 1 produces a <b>tangent ogive</b>, which has a smooth transition to the body tube, values less than 1 produce <b>secant ogives</b>. + trans.get("Shape.Ogive.desc1"), + //// An ogive transition has a profile that is a segment of a circle. The shape parameter value 1 produces a <b>tangent ogive</b>, which has a smooth transition to the body tube at the aft end, values less than 1 produce <b>secant ogives</b>. + trans.get("Shape.Ogive.desc2")) { @Override public boolean usesParameter() { return true; // Range 0...1 is default @@ -603,13 +606,12 @@ public class Transition extends SymmetricComponent { /** * Ellipsoidal shape. */ - ELLIPSOID("Ellipsoid", - "An ellipsoidal nose cone has a profile of a half-ellipse " + - "with major axes of lengths 2×<i>Length</i> and <i>Diameter</i>.", - "An ellipsoidal transition has a profile of a half-ellipse " + - "with major axes of lengths 2×<i>Length</i> and <i>Diameter</i>. If the " + - "transition is not clipped, then the profile is extended at the center by the " + - "corresponding radius.", true) { + //// Ellipsoid + ELLIPSOID(trans.get("Shape.Ellipsoid"), + //// An ellipsoidal nose cone has a profile of a half-ellipse with major axes of lengths 2×<i>Length</i> and <i>Diameter</i>. + trans.get("Shape.Ellipsoid.desc1"), + //// An ellipsoidal transition has a profile of a half-ellipse with major axes of lengths 2×<i>Length</i> and <i>Diameter</i>. If the transition is not clipped, then the profile is extended at the center by the corresponding radius. + trans.get("Shape.Ellipsoid.desc2"), true) { @Override public double getRadius(double x, double radius, double length, double param) { assert x >= 0; @@ -619,20 +621,20 @@ public class Transition extends SymmetricComponent { return sqrt(2 * radius * x - x * x); // radius/length * sphere } }, - - POWER("Power series", - "A power series nose cone has a profile of " + - "<i>Radius</i> × (<i>x</i> / <i>Length</i>)" + - "<sup><i>k</i></sup> " + - "where <i>k</i> is the shape parameter. For <i>k</i>=0.5 this is a " + - "<b>" + FRAC12 + "-power</b> or <b>parabolic</b> nose cone, for <i>k</i>=0.75 a " + - "<b>" + FRAC34 + "-power</b>, and for <i>k</i>=1 a <b>conical</b> nose cone.", - "A power series transition has a profile of " + - "<i>Radius</i> × (<i>x</i> / <i>Length</i>)" + - "<sup><i>k</i></sup> " + - "where <i>k</i> is the shape parameter. For <i>k</i>=0.5 the transition is " + - "<b>" + FRAC12 + "-power</b> or <b>parabolic</b>, for <i>k</i>=0.75 a " + - "<b>" + FRAC34 + "-power</b>, and for <i>k</i>=1 <b>conical</b>.", true) { + //// Power series + POWER(trans.get("Shape.Powerseries"), + //// A power series nose cone has a profile of <i>Radius</i> × (<i>x</i> / <i>Length</i>)<sup><i>k</i></sup> where <i>k</i> is the shape parameter. For <i>k</i>=0.5 this is a <b> + trans.get("Shape.Powerseries.descA1") + FRAC12 + + //// -power</b> or <b>parabolic</b> nose cone, for <i>k</i>=0.75 a <b> + trans.get("Shape.Powerseries.descA2") + FRAC34 + + //// -power</b>, and for <i>k</i>=1 a <b>conical</b> nose cone. + trans.get("Shape.Powerseries.descA3"), + //// A power series transition has a profile of <i>Radius</i> × (<i>x</i> / <i>Length</i>)<sup><i>k</i></sup> where <i>k</i> is the shape parameter. For <i>k</i>=0.5 the transition is <b> + trans.get("Shape.Powerseries.descB1") + FRAC12 + + //// -power</b> or <b>parabolic</b>, for <i>k</i>=0.75 a <b> + trans.get("Shape.Powerseries.descB2") + FRAC34 + + //// -power</b>, and for <i>k</i>=1 <b>conical</b>. + trans.get("Shape.Powerseries.descB3"), true) { @Override public boolean usesParameter() { // Range 0...1 return true; @@ -660,22 +662,16 @@ public class Transition extends SymmetricComponent { } }, - - PARABOLIC("Parabolic series", - "A parabolic series nose cone has a profile of a parabola. The shape " + - "parameter defines the segment of the parabola to utilize. The shape " + - "parameter 1.0 produces a <b>full parabola</b> which is tangent to the body " + - "tube, 0.75 produces a <b>3/4 parabola</b>, 0.5 procudes a " + - "<b>1/2 parabola</b> and 0 produces a <b>conical</b> nose cone.", - "A parabolic series transition has a profile of a parabola. The shape " + - "parameter defines the segment of the parabola to utilize. The shape " + - "parameter 1.0 produces a <b>full parabola</b> which is tangent to the body " + - "tube at the aft end, 0.75 produces a <b>3/4 parabola</b>, 0.5 procudes a " + - "<b>1/2 parabola</b> and 0 produces a <b>conical</b> transition.") { + //// Parabolic series + PARABOLIC(trans.get("Shape.Parabolicseries"), + ////A parabolic series nose cone has a profile of a parabola. The shape parameter defines the segment of the parabola to utilize. The shape parameter 1.0 produces a <b>full parabola</b> which is tangent to the body tube, 0.75 produces a <b>3/4 parabola</b>, 0.5 procudes a <b>1/2 parabola</b> and 0 produces a <b>conical</b> nose cone. + trans.get("Shape.Parabolicseries.desc1"), + ////A parabolic series transition has a profile of a parabola. The shape parameter defines the segment of the parabola to utilize. The shape parameter 1.0 produces a <b>full parabola</b> which is tangent to the body tube at the aft end, 0.75 produces a <b>3/4 parabola</b>, 0.5 procudes a <b>1/2 parabola</b> and 0 produces a <b>conical</b> transition. + trans.get("Shape.Parabolicseries.desc2")) { // In principle a parabolic transition is clippable, but the difference is // negligible. - + @Override public boolean usesParameter() { // Range 0...1 return true; @@ -699,17 +695,12 @@ public class Transition extends SymmetricComponent { }, - - HAACK("Haack series", - "The Haack series nose cones are designed to minimize drag. The shape parameter " + - "0 produces an <b>LD-Haack</b> or <b>Von Karman</b> nose cone, which minimizes " + - "drag for fixed length and diameter, while a value of 0.333 produces an " + - "<b>LV-Haack</b> nose cone, which minimizes drag for fixed length and volume.", - "The Haack series <i>nose cones</i> are designed to minimize drag. " + - "These transition shapes are their equivalents, but do not necessarily produce " + - "optimal drag for transitions. " + - "The shape parameter 0 produces an <b>LD-Haack</b> or <b>Von Karman</b> shape, " + - "while a value of 0.333 produces an <b>LV-Haack</b> shape.", true) { + //// Haack series + HAACK(trans.get("Shape.Haackseries"), + //// The Haack series nose cones are designed to minimize drag. The shape parameter 0 produces an <b>LD-Haack</b> or <b>Von Karman</b> nose cone, which minimizes drag for fixed length and diameter, while a value of 0.333 produces an <b>LV-Haack</b> nose cone, which minimizes drag for fixed length and volume. + trans.get("Shape.Haackseries.desc1"), + //// The Haack series <i>nose cones</i> are designed to minimize drag. These transition shapes are their equivalents, but do not necessarily produce optimal drag for transitions. The shape parameter 0 produces an <b>LD-Haack</b> or <b>Von Karman</b> shape, while a value of 0.333 produces an <b>LV-Haack</b> shape. + trans.get("Shape.Haackseries.desc2"), true) { @Override public boolean usesParameter() { return true; diff --git a/src/net/sf/openrocket/rocketcomponent/TrapezoidFinSet.java b/src/net/sf/openrocket/rocketcomponent/TrapezoidFinSet.java index 6f8ef943..fb276a7c 100644 --- a/src/net/sf/openrocket/rocketcomponent/TrapezoidFinSet.java +++ b/src/net/sf/openrocket/rocketcomponent/TrapezoidFinSet.java @@ -1,5 +1,7 @@ package net.sf.openrocket.rocketcomponent; +import net.sf.openrocket.l10n.Translator; +import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.Coordinate; /** @@ -10,6 +12,8 @@ import net.sf.openrocket.util.Coordinate; */ public class TrapezoidFinSet extends FinSet { + private static final Translator trans = Application.getTranslator(); + public static final double MAX_SWEEP_ANGLE=(89*Math.PI/180.0); /* @@ -163,7 +167,8 @@ public class TrapezoidFinSet extends FinSet { @Override public String getComponentName() { - return "Trapezoidal fin set"; + //// Trapezoidal fin set + return trans.get("TrapezoidFinSet.TrapezoidFinSet"); } /** diff --git a/src/net/sf/openrocket/rocketcomponent/TubeCoupler.java b/src/net/sf/openrocket/rocketcomponent/TubeCoupler.java index 540535e1..5e22ec0c 100644 --- a/src/net/sf/openrocket/rocketcomponent/TubeCoupler.java +++ b/src/net/sf/openrocket/rocketcomponent/TubeCoupler.java @@ -1,8 +1,12 @@ package net.sf.openrocket.rocketcomponent; +import net.sf.openrocket.l10n.Translator; +import net.sf.openrocket.startup.Application; + public class TubeCoupler extends ThicknessRingComponent implements RadialParent { - + private static final Translator trans = Application.getTranslator(); + public TubeCoupler() { setOuterRadiusAutomatic(true); setThickness(0.002); @@ -19,7 +23,8 @@ public class TubeCoupler extends ThicknessRingComponent implements RadialParent @Override public String getComponentName() { - return "Tube coupler"; + //// Tube coupler + return trans.get("TubeCoupler.TubeCoupler"); } @Override diff --git a/src/net/sf/openrocket/simulation/FlightDataType.java b/src/net/sf/openrocket/simulation/FlightDataType.java index a089d4c1..eea84dde 100644 --- a/src/net/sf/openrocket/simulation/FlightDataType.java +++ b/src/net/sf/openrocket/simulation/FlightDataType.java @@ -3,6 +3,8 @@ package net.sf.openrocket.simulation; import java.util.HashMap; import java.util.Map; +import net.sf.openrocket.l10n.Translator; +import net.sf.openrocket.startup.Application; import net.sf.openrocket.unit.UnitGroup; /** @@ -19,7 +21,8 @@ import net.sf.openrocket.unit.UnitGroup; * @author Sampo Niskanen <sampo.niskanen@iki.fi> */ public class FlightDataType implements Comparable<FlightDataType> { - + private static final Translator trans = Application.getTranslator(); + /** Priority of custom-created variables */ private static final int DEFAULT_PRIORITY = 999; @@ -29,98 +32,145 @@ public class FlightDataType implements Comparable<FlightDataType> { //// Time - public static final FlightDataType TYPE_TIME = newType("Time", UnitGroup.UNITS_FLIGHT_TIME, 1); + public static final FlightDataType TYPE_TIME = newType(trans.get("FlightDataType.TYPE_TIME"), UnitGroup.UNITS_FLIGHT_TIME, 1); //// Vertical position and motion - public static final FlightDataType TYPE_ALTITUDE = newType("Altitude", UnitGroup.UNITS_DISTANCE, 10); - public static final FlightDataType TYPE_VELOCITY_Z = newType("Vertical velocity", UnitGroup.UNITS_VELOCITY, 11); - public static final FlightDataType TYPE_ACCELERATION_Z = newType("Vertical acceleration", UnitGroup.UNITS_ACCELERATION, 12); + //// Altitude + public static final FlightDataType TYPE_ALTITUDE = newType(trans.get("FlightDataType.TYPE_ALTITUDE"), UnitGroup.UNITS_DISTANCE, 10); + //// Vertical velocity + public static final FlightDataType TYPE_VELOCITY_Z = newType(trans.get("FlightDataType.TYPE_VELOCITY_Z"), UnitGroup.UNITS_VELOCITY, 11); + //// Vertical acceleration + public static final FlightDataType TYPE_ACCELERATION_Z = newType(trans.get("FlightDataType.TYPE_ACCELERATION_Z"), UnitGroup.UNITS_ACCELERATION, 12); //// Total motion - public static final FlightDataType TYPE_VELOCITY_TOTAL = newType("Total velocity", UnitGroup.UNITS_VELOCITY, 20); - public static final FlightDataType TYPE_ACCELERATION_TOTAL = newType("Total acceleration", UnitGroup.UNITS_ACCELERATION, 21); + //// Total velocity + public static final FlightDataType TYPE_VELOCITY_TOTAL = newType(trans.get("FlightDataType.TYPE_VELOCITY_TOTAL"), UnitGroup.UNITS_VELOCITY, 20); + //// Total acceleration + public static final FlightDataType TYPE_ACCELERATION_TOTAL = newType(trans.get("FlightDataType.TYPE_ACCELERATION_TOTAL"), UnitGroup.UNITS_ACCELERATION, 21); //// Lateral position and motion - - public static final FlightDataType TYPE_POSITION_X = newType("Position upwind", UnitGroup.UNITS_DISTANCE, 30); - public static final FlightDataType TYPE_POSITION_Y = newType("Position parallel to wind", UnitGroup.UNITS_DISTANCE, 31); - public static final FlightDataType TYPE_POSITION_XY = newType("Lateral distance", UnitGroup.UNITS_DISTANCE, 32); - public static final FlightDataType TYPE_POSITION_DIRECTION = newType("Lateral direction", UnitGroup.UNITS_ANGLE, 33); - - public static final FlightDataType TYPE_VELOCITY_XY = newType("Lateral velocity", UnitGroup.UNITS_VELOCITY, 34); - public static final FlightDataType TYPE_ACCELERATION_XY = newType("Lateral acceleration", UnitGroup.UNITS_ACCELERATION, 35); + //// Position upwind + public static final FlightDataType TYPE_POSITION_X = newType(trans.get("FlightDataType.TYPE_POSITION_X"), UnitGroup.UNITS_DISTANCE, 30); + //// Position parallel to wind + public static final FlightDataType TYPE_POSITION_Y = newType(trans.get("FlightDataType.TYPE_POSITION_Y"), UnitGroup.UNITS_DISTANCE, 31); + //// Lateral distance + public static final FlightDataType TYPE_POSITION_XY = newType(trans.get("FlightDataType.TYPE_POSITION_XY"), UnitGroup.UNITS_DISTANCE, 32); + //// Lateral direction + public static final FlightDataType TYPE_POSITION_DIRECTION = newType(trans.get("FlightDataType.TYPE_POSITION_DIRECTION"), UnitGroup.UNITS_ANGLE, 33); + //// Lateral velocity + public static final FlightDataType TYPE_VELOCITY_XY = newType(trans.get("FlightDataType.TYPE_VELOCITY_XY"), UnitGroup.UNITS_VELOCITY, 34); + //// Lateral acceleration + public static final FlightDataType TYPE_ACCELERATION_XY = newType(trans.get("FlightDataType.TYPE_ACCELERATION_XY"), UnitGroup.UNITS_ACCELERATION, 35); //// Angular motion - public static final FlightDataType TYPE_AOA = newType("Angle of attack", UnitGroup.UNITS_ANGLE, 40); - public static final FlightDataType TYPE_ROLL_RATE = newType("Roll rate", UnitGroup.UNITS_ROLL, 41); - public static final FlightDataType TYPE_PITCH_RATE = newType("Pitch rate", UnitGroup.UNITS_ROLL, 42); - public static final FlightDataType TYPE_YAW_RATE = newType("Yaw rate", UnitGroup.UNITS_ROLL, 43); + //// Angle of attack + public static final FlightDataType TYPE_AOA = newType(trans.get("FlightDataType.TYPE_AOA"), UnitGroup.UNITS_ANGLE, 40); + //// Roll rate + public static final FlightDataType TYPE_ROLL_RATE = newType(trans.get("FlightDataType.TYPE_ROLL_RATE"), UnitGroup.UNITS_ROLL, 41); + //// Pitch rate + public static final FlightDataType TYPE_PITCH_RATE = newType(trans.get("FlightDataType.TYPE_PITCH_RATE"), UnitGroup.UNITS_ROLL, 42); + //// Yaw rate + public static final FlightDataType TYPE_YAW_RATE = newType(trans.get("FlightDataType.TYPE_YAW_RATE"), UnitGroup.UNITS_ROLL, 43); //// Stability information - public static final FlightDataType TYPE_MASS = newType("Mass", UnitGroup.UNITS_MASS, 50); - public static final FlightDataType TYPE_LONGITUDINAL_INERTIA = newType("Longitudinal moment of inertia", UnitGroup.UNITS_INERTIA, 51); - public static final FlightDataType TYPE_ROTATIONAL_INERTIA = newType("Rotational moment of inertia", UnitGroup.UNITS_INERTIA, 52); - public static final FlightDataType TYPE_CP_LOCATION = newType("CP location", UnitGroup.UNITS_LENGTH, 53); - public static final FlightDataType TYPE_CG_LOCATION = newType("CG location", UnitGroup.UNITS_LENGTH, 54); - public static final FlightDataType TYPE_STABILITY = newType("Stability margin calibers", UnitGroup.UNITS_COEFFICIENT, 55); + //// Mass + public static final FlightDataType TYPE_MASS = newType(trans.get("FlightDataType.TYPE_MASS"), UnitGroup.UNITS_MASS, 50); + //// Longitudinal moment of inertia + public static final FlightDataType TYPE_LONGITUDINAL_INERTIA = newType(trans.get("FlightDataType.TYPE_LONGITUDINAL_INERTIA"), UnitGroup.UNITS_INERTIA, 51); + //// Rotational moment of inertia + public static final FlightDataType TYPE_ROTATIONAL_INERTIA = newType(trans.get("FlightDataType.TYPE_ROTATIONAL_INERTIA"), UnitGroup.UNITS_INERTIA, 52); + //// CP location + public static final FlightDataType TYPE_CP_LOCATION = newType(trans.get("FlightDataType.TYPE_CP_LOCATION"), UnitGroup.UNITS_LENGTH, 53); + //// CG location + public static final FlightDataType TYPE_CG_LOCATION = newType(trans.get("FlightDataType.TYPE_CG_LOCATION"), UnitGroup.UNITS_LENGTH, 54); + //// Stability margin calibers + public static final FlightDataType TYPE_STABILITY = newType(trans.get("FlightDataType.TYPE_STABILITY"), UnitGroup.UNITS_COEFFICIENT, 55); //// Characteristic numbers - public static final FlightDataType TYPE_MACH_NUMBER = newType("Mach number", UnitGroup.UNITS_COEFFICIENT, 60); - public static final FlightDataType TYPE_REYNOLDS_NUMBER = newType("Reynolds number", UnitGroup.UNITS_COEFFICIENT, 61); + //// Mach number + public static final FlightDataType TYPE_MACH_NUMBER = newType(trans.get("FlightDataType.TYPE_MACH_NUMBER"), UnitGroup.UNITS_COEFFICIENT, 60); + //// Reynolds number + public static final FlightDataType TYPE_REYNOLDS_NUMBER = newType(trans.get("FlightDataType.TYPE_REYNOLDS_NUMBER"), UnitGroup.UNITS_COEFFICIENT, 61); //// Thrust and drag - public static final FlightDataType TYPE_THRUST_FORCE = newType("Thrust", UnitGroup.UNITS_FORCE, 70); - public static final FlightDataType TYPE_DRAG_FORCE = newType("Drag force", UnitGroup.UNITS_FORCE, 71); - public static final FlightDataType TYPE_DRAG_COEFF = newType("Drag coefficient", UnitGroup.UNITS_COEFFICIENT, 72); - public static final FlightDataType TYPE_AXIAL_DRAG_COEFF = newType("Axial drag coefficient", UnitGroup.UNITS_COEFFICIENT, 73); + //// Thrust + public static final FlightDataType TYPE_THRUST_FORCE = newType(trans.get("FlightDataType.TYPE_THRUST_FORCE"), UnitGroup.UNITS_FORCE, 70); + //// Drag force + public static final FlightDataType TYPE_DRAG_FORCE = newType(trans.get("FlightDataType.TYPE_DRAG_FORCE"), UnitGroup.UNITS_FORCE, 71); + //// Drag coefficient + public static final FlightDataType TYPE_DRAG_COEFF = newType(trans.get("FlightDataType.TYPE_DRAG_COEFF"), UnitGroup.UNITS_COEFFICIENT, 72); + //// Axial drag coefficient + public static final FlightDataType TYPE_AXIAL_DRAG_COEFF = newType(trans.get("FlightDataType.TYPE_AXIAL_DRAG_COEFF"), UnitGroup.UNITS_COEFFICIENT, 73); //// Component drag coefficients - public static final FlightDataType TYPE_FRICTION_DRAG_COEFF = newType("Friction drag coefficient", UnitGroup.UNITS_COEFFICIENT, 80); - public static final FlightDataType TYPE_PRESSURE_DRAG_COEFF = newType("Pressure drag coefficient", UnitGroup.UNITS_COEFFICIENT, 81); - public static final FlightDataType TYPE_BASE_DRAG_COEFF = newType("Base drag coefficient", UnitGroup.UNITS_COEFFICIENT, 82); + //// Friction drag coefficient + public static final FlightDataType TYPE_FRICTION_DRAG_COEFF = newType(trans.get("FlightDataType.TYPE_FRICTION_DRAG_COEFF"), UnitGroup.UNITS_COEFFICIENT, 80); + //// Pressure drag coefficient + public static final FlightDataType TYPE_PRESSURE_DRAG_COEFF = newType(trans.get("FlightDataType.TYPE_PRESSURE_DRAG_COEFF"), UnitGroup.UNITS_COEFFICIENT, 81); + //// Base drag coefficient + public static final FlightDataType TYPE_BASE_DRAG_COEFF = newType(trans.get("FlightDataType.TYPE_BASE_DRAG_COEFF"), UnitGroup.UNITS_COEFFICIENT, 82); //// Other coefficients - public static final FlightDataType TYPE_NORMAL_FORCE_COEFF = newType("Normal force coefficient", UnitGroup.UNITS_COEFFICIENT, 90); - public static final FlightDataType TYPE_PITCH_MOMENT_COEFF = newType("Pitch moment coefficient", UnitGroup.UNITS_COEFFICIENT, 91); - public static final FlightDataType TYPE_YAW_MOMENT_COEFF = newType("Yaw moment coefficient", UnitGroup.UNITS_COEFFICIENT, 92); - public static final FlightDataType TYPE_SIDE_FORCE_COEFF = newType("Side force coefficient", UnitGroup.UNITS_COEFFICIENT, 93); - public static final FlightDataType TYPE_ROLL_MOMENT_COEFF = newType("Roll moment coefficient", UnitGroup.UNITS_COEFFICIENT, 94); - public static final FlightDataType TYPE_ROLL_FORCING_COEFF = newType("Roll forcing coefficient", UnitGroup.UNITS_COEFFICIENT, 95); - public static final FlightDataType TYPE_ROLL_DAMPING_COEFF = newType("Roll damping coefficient", UnitGroup.UNITS_COEFFICIENT, 96); - - public static final FlightDataType TYPE_PITCH_DAMPING_MOMENT_COEFF = newType("Pitch damping coefficient", UnitGroup.UNITS_COEFFICIENT, 97); - public static final FlightDataType TYPE_YAW_DAMPING_MOMENT_COEFF = newType("Yaw damping coefficient", UnitGroup.UNITS_COEFFICIENT, 98); + //// Normal force coefficient + public static final FlightDataType TYPE_NORMAL_FORCE_COEFF = newType(trans.get("FlightDataType.TYPE_NORMAL_FORCE_COEFF"), UnitGroup.UNITS_COEFFICIENT, 90); + //// Pitch moment coefficient + public static final FlightDataType TYPE_PITCH_MOMENT_COEFF = newType(trans.get("FlightDataType.TYPE_PITCH_MOMENT_COEFF"), UnitGroup.UNITS_COEFFICIENT, 91); + //// Yaw moment coefficient + public static final FlightDataType TYPE_YAW_MOMENT_COEFF = newType(trans.get("FlightDataType.TYPE_YAW_MOMENT_COEFF"), UnitGroup.UNITS_COEFFICIENT, 92); + //// Side force coefficient + public static final FlightDataType TYPE_SIDE_FORCE_COEFF = newType(trans.get("FlightDataType.TYPE_SIDE_FORCE_COEFF"), UnitGroup.UNITS_COEFFICIENT, 93); + //// Roll moment coefficient + public static final FlightDataType TYPE_ROLL_MOMENT_COEFF = newType(trans.get("FlightDataType.TYPE_ROLL_MOMENT_COEFF"), UnitGroup.UNITS_COEFFICIENT, 94); + //// Roll forcing coefficient + public static final FlightDataType TYPE_ROLL_FORCING_COEFF = newType(trans.get("FlightDataType.TYPE_ROLL_FORCING_COEFF"), UnitGroup.UNITS_COEFFICIENT, 95); + //// Roll damping coefficient + public static final FlightDataType TYPE_ROLL_DAMPING_COEFF = newType(trans.get("FlightDataType.TYPE_ROLL_DAMPING_COEFF"), UnitGroup.UNITS_COEFFICIENT, 96); + + //// Pitch damping coefficient + public static final FlightDataType TYPE_PITCH_DAMPING_MOMENT_COEFF = newType(trans.get("FlightDataType.TYPE_PITCH_DAMPING_MOMENT_COEFF"), UnitGroup.UNITS_COEFFICIENT, 97); + //// Yaw damping coefficient + public static final FlightDataType TYPE_YAW_DAMPING_MOMENT_COEFF = newType(trans.get("FlightDataType.TYPE_YAW_DAMPING_MOMENT_COEFF"), UnitGroup.UNITS_COEFFICIENT, 98); //// Reference length + area - public static final FlightDataType TYPE_REFERENCE_LENGTH = newType("Reference length", UnitGroup.UNITS_LENGTH, 100); - public static final FlightDataType TYPE_REFERENCE_AREA = newType("Reference area", UnitGroup.UNITS_AREA, 101); + //// Reference length + public static final FlightDataType TYPE_REFERENCE_LENGTH = newType(trans.get("FlightDataType.TYPE_REFERENCE_LENGTH"), UnitGroup.UNITS_LENGTH, 100); + //// Reference area + public static final FlightDataType TYPE_REFERENCE_AREA = newType(trans.get("FlightDataType.TYPE_REFERENCE_AREA"), UnitGroup.UNITS_AREA, 101); //// Orientation - public static final FlightDataType TYPE_ORIENTATION_THETA = newType("Vertical orientation (zenith)", UnitGroup.UNITS_ANGLE, 106); - public static final FlightDataType TYPE_ORIENTATION_PHI = newType("Lateral orientation (azimuth)", UnitGroup.UNITS_ANGLE, 107); + //// Vertical orientation (zenith) + public static final FlightDataType TYPE_ORIENTATION_THETA = newType(trans.get("FlightDataType.TYPE_ORIENTATION_THETA"), UnitGroup.UNITS_ANGLE, 106); + //// Lateral orientation (azimuth) + public static final FlightDataType TYPE_ORIENTATION_PHI = newType(trans.get("FlightDataType.TYPE_ORIENTATION_PHI"), UnitGroup.UNITS_ANGLE, 107); //// Atmospheric conditions - public static final FlightDataType TYPE_WIND_VELOCITY = newType("Wind velocity", UnitGroup.UNITS_VELOCITY, 110); - public static final FlightDataType TYPE_AIR_TEMPERATURE = newType("Air temperature", UnitGroup.UNITS_TEMPERATURE, 111); - public static final FlightDataType TYPE_AIR_PRESSURE = newType("Air pressure", UnitGroup.UNITS_PRESSURE, 112); - public static final FlightDataType TYPE_SPEED_OF_SOUND = newType("Speed of sound", UnitGroup.UNITS_VELOCITY, 113); + //// Wind velocity + public static final FlightDataType TYPE_WIND_VELOCITY = newType(trans.get("FlightDataType.TYPE_WIND_VELOCITY"), UnitGroup.UNITS_VELOCITY, 110); + //// Air temperature + public static final FlightDataType TYPE_AIR_TEMPERATURE = newType(trans.get("FlightDataType.TYPE_AIR_TEMPERATURE"), UnitGroup.UNITS_TEMPERATURE, 111); + //// Air pressure + public static final FlightDataType TYPE_AIR_PRESSURE = newType(trans.get("FlightDataType.TYPE_AIR_PRESSURE"), UnitGroup.UNITS_PRESSURE, 112); + //// Speed of sound + public static final FlightDataType TYPE_SPEED_OF_SOUND = newType(trans.get("FlightDataType.TYPE_SPEED_OF_SOUND"), UnitGroup.UNITS_VELOCITY, 113); //// Simulation information - public static final FlightDataType TYPE_TIME_STEP = newType("Simulation time step", UnitGroup.UNITS_TIME_STEP, 200); - public static final FlightDataType TYPE_COMPUTATION_TIME = newType("Computation time", UnitGroup.UNITS_SHORT_TIME, 201); + //// Simulation time step + public static final FlightDataType TYPE_TIME_STEP = newType(trans.get("FlightDataType.TYPE_TIME_STEP"), UnitGroup.UNITS_TIME_STEP, 200); + //// Computation time + public static final FlightDataType TYPE_COMPUTATION_TIME = newType(trans.get("FlightDataType.TYPE_COMPUTATION_TIME"), UnitGroup.UNITS_SHORT_TIME, 201); diff --git a/src/net/sf/openrocket/simulation/FlightEvent.java b/src/net/sf/openrocket/simulation/FlightEvent.java index 843f6c88..ead84eec 100644 --- a/src/net/sf/openrocket/simulation/FlightEvent.java +++ b/src/net/sf/openrocket/simulation/FlightEvent.java @@ -1,6 +1,8 @@ package net.sf.openrocket.simulation; +import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.rocketcomponent.RocketComponent; +import net.sf.openrocket.startup.Application; /** @@ -9,7 +11,8 @@ import net.sf.openrocket.rocketcomponent.RocketComponent; * @author Sampo Niskanen <sampo.niskanen@iki.fi> */ public class FlightEvent implements Comparable<FlightEvent> { - + private static final Translator trans = Application.getTranslator(); + /** * The type of the flight event. * @@ -19,57 +22,69 @@ public class FlightEvent implements Comparable<FlightEvent> { /** * Rocket launch. */ - LAUNCH("Launch"), + //// Launch + LAUNCH(trans.get("FlightEvent.Type.LAUNCH")), /** * Ignition of a motor. Source is the motor mount the motor of which has ignited, * and the data is the MotorId of the motor instance. */ - IGNITION("Motor ignition"), + //// Motor ignition + IGNITION(trans.get("FlightEvent.Type.IGNITION")), /** * When the motor has lifted off the ground. */ - LIFTOFF("Lift-off"), + //// Lift-off + LIFTOFF(trans.get("FlightEvent.Type.LIFTOFF")), /** * Launch rod has been cleared. */ - LAUNCHROD("Launch rod clearance"), + //// Launch rod clearance + LAUNCHROD(trans.get("FlightEvent.Type.LAUNCHROD")), /** * Burnout of a motor. Source is the motor mount the motor of which has burnt out, * and the data is the MotorId of the motor instance. */ - BURNOUT("Motor burnout"), + //// Motor burnout + BURNOUT(trans.get("FlightEvent.Type.BURNOUT")), /** * Ejection charge of a motor fired. Source is the motor mount the motor of * which has exploded its ejection charge, and data is the MotorId of the motor instance. */ - EJECTION_CHARGE("Ejection charge"), + //// Ejection charge + EJECTION_CHARGE(trans.get("FlightEvent.Type.EJECTION_CHARGE")), /** * Separation of a stage. Source is the stage which has separated all lower stages. */ - STAGE_SEPARATION("Stage separation"), + //// Stage separation + STAGE_SEPARATION(trans.get("FlightEvent.Type.STAGE_SEPARATION")), /** * Apogee has been reached. */ - APOGEE("Apogee"), + //// Apogee + APOGEE(trans.get("FlightEvent.Type.APOGEE")), /** * Opening of a recovery device. Source is the RecoveryComponent which has opened. */ - RECOVERY_DEVICE_DEPLOYMENT("Recovery device deployment"), + //// Recovery device deployment + RECOVERY_DEVICE_DEPLOYMENT(trans.get("FlightEvent.Type.RECOVERY_DEVICE_DEPLOYMENT")), /** * Ground has been hit after flight. */ - GROUND_HIT("Ground hit"), + //// Ground hit + GROUND_HIT(trans.get("FlightEvent.Type.GROUND_HIT")), /** * End of simulation. Placing this to the queue will end the simulation. */ - SIMULATION_END("Simulation end"), + //// Simulation end + SIMULATION_END(trans.get("FlightEvent.Type.SIMULATION_END")), /** * A change in altitude has occurred. Data is a <code>Pair<Double,Double></code> * which contains the old and new altitudes. */ - ALTITUDE("Altitude change"); + //// Altitude change + ALTITUDE(trans.get("FlightEvent.Type.ALTITUDE")); private final String name; diff --git a/src/net/sf/openrocket/util/LineStyle.java b/src/net/sf/openrocket/util/LineStyle.java index efc946ba..edd562b3 100644 --- a/src/net/sf/openrocket/util/LineStyle.java +++ b/src/net/sf/openrocket/util/LineStyle.java @@ -2,22 +2,33 @@ package net.sf.openrocket.util; import java.util.Arrays; +import net.sf.openrocket.l10n.Translator; +import net.sf.openrocket.startup.Application; + /** * An enumeration of line styles. The line styles are defined by an array of * floats suitable for <code>BasicStroke</code>. * * @author Sampo Niskanen <sampo.niskanen@iki.fi> */ + public enum LineStyle { - SOLID("Solid",new float[] { 10f, 0f }), - DASHED("Dashed",new float[] { 6f, 4f }), - DOTTED("Dotted",new float[] { 2f, 3f }), - DASHDOT("Dash-dotted",new float[] { 8f, 3f, 2f, 3f}) + + //// Solid + SOLID("LineStyle.Solid",new float[] { 10f, 0f }), + //// Dashed + DASHED("LineStyle.Dashed",new float[] { 6f, 4f }), + //// Dotted + DOTTED("LineStyle.Dotted",new float[] { 2f, 3f }), + //// Dash-dotted + DASHDOT("LineStyle.Dash-dotted",new float[] { 8f, 3f, 2f, 3f}) ; private final String name; private final float[] dashes; + LineStyle(String name, float[] dashes) { + this.name = name; this.dashes = dashes; } @@ -26,6 +37,7 @@ public enum LineStyle { } @Override public String toString() { - return name; + final Translator trans = Application.getTranslator(); + return trans.get(name); } } \ No newline at end of file diff --git a/src/net/sf/openrocket/util/Prefs.java b/src/net/sf/openrocket/util/Prefs.java index ac3144e2..215389ab 100644 --- a/src/net/sf/openrocket/util/Prefs.java +++ b/src/net/sf/openrocket/util/Prefs.java @@ -22,6 +22,7 @@ import net.sf.openrocket.arch.SystemInfo; import net.sf.openrocket.database.Databases; import net.sf.openrocket.document.Simulation; import net.sf.openrocket.gui.main.ExceptionHandler; +import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.logging.LogHelper; import net.sf.openrocket.material.Material; import net.sf.openrocket.rocketcomponent.BodyComponent; @@ -198,13 +199,18 @@ public class Prefs { * Within a holder class so they will load only when needed. */ private static class DefaultMaterialHolder { + private static final Translator trans = Application.getTranslator(); + + //// Elastic cord (round 2mm, 1/16 in) private static final Material DEFAULT_LINE_MATERIAL = - Databases.findMaterial(Material.Type.LINE, "Elastic cord (round 2mm, 1/16 in)", + Databases.findMaterial(Material.Type.LINE, trans.get("Databases.materials.Elasticcordround2mm"), 0.0018, false); + //// Ripstop nylon private static final Material DEFAULT_SURFACE_MATERIAL = - Databases.findMaterial(Material.Type.SURFACE, "Ripstop nylon", 0.067, false); + Databases.findMaterial(Material.Type.SURFACE, trans.get("Databases.materials.Ripstopnylon"), 0.067, false); + //// Cardboard private static final Material DEFAULT_BULK_MATERIAL = - Databases.findMaterial(Material.Type.BULK, "Cardboard", 680, false); + Databases.findMaterial(Material.Type.BULK, trans.get("Databases.materials.Cardboard"), 680, false); } ////////////////////// -- 2.30.2