I18 changes
[debian/openrocket] / src / net / sf / openrocket / rocketcomponent / ExternalComponent.java
index 8a12090465f764ce457652df8117fb8f9708c68e..0f19b43057a2596f1a9cad8ecff84f31a2640e98 100644 (file)
@@ -1,6 +1,10 @@
 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;
 
@@ -15,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;
@@ -35,20 +44,21 @@ 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) + ")";
                }
        }
        
-
+       
        /**
         * The material of the component.
         */
-       protected Material material=null;
+       protected Material material = null;
        
        protected Finish finish = Finish.NORMAL;
        
        
-       
+
        /**
         * Constructor that sets the relative position of the component.
         */
@@ -56,13 +66,13 @@ public abstract class ExternalComponent extends RocketComponent {
                super(relativePosition);
                this.material = Prefs.getDefaultComponentMaterial(this.getClass(), Material.Type.BULK);
        }
-
+       
        /**
         * Returns the volume of the component.  This value is used in calculating the mass
         * of the object.
         */
        public abstract double getComponentVolume();
-
+       
        /**
         * Calculates the mass of the component as the product of the volume and interior density.
         */
@@ -70,7 +80,7 @@ public abstract class ExternalComponent extends RocketComponent {
        public double getComponentMass() {
                return material.getDensity() * getComponentVolume();
        }
-
+       
        /**
         * ExternalComponent has aerodynamic effect, so return true.
         */
@@ -95,9 +105,9 @@ public abstract class ExternalComponent extends RocketComponent {
        public void setMaterial(Material mat) {
                if (mat.getType() != Material.Type.BULK) {
                        throw new IllegalArgumentException("ExternalComponent requires a bulk material" +
-                                       " type="+mat.getType());
+                                       " type=" + mat.getType());
                }
-
+               
                if (material.equals(mat))
                        return;
                material = mat;
@@ -114,16 +124,15 @@ public abstract class ExternalComponent extends RocketComponent {
                this.finish = finish;
                fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE);
        }
-
        
        
+
        @Override
-       protected void copyFrom(RocketComponent c) {
-               super.copyFrom(c);
-               
-               ExternalComponent src = (ExternalComponent)c;
+       protected List<RocketComponent> copyFrom(RocketComponent c) {
+               ExternalComponent src = (ExternalComponent) c;
                this.finish = src.finish;
                this.material = src.material;
+               return super.copyFrom(c);
        }
        
     /**