Applied patch for l10n supplied by Russian Uss.
[debian/openrocket] / core / src / net / sf / openrocket / material / Material.java
index f52acf51df97664c53e6425bac569f306188eda2..f8fe76a855425a17133d94450dd76bd2dec477af 100644 (file)
@@ -30,7 +30,7 @@ public abstract class Material implements Comparable<Material> {
                private final UnitGroup units;
                
                private Type(String name, UnitGroup units) {
-                       this.name = name;
+                       this.name = trans.get ("Databases.materials.types." + name);
                        this.units = units;
                }
                
@@ -215,6 +215,26 @@ public abstract class Material implements Comparable<Material> {
                }
        }
        
+       /**
+        * Return a new user defined material of the specified type and localizable key.
+        */
+       public static Material newUserMaterialWithKey(Type type, String key, String name, double density) {
+               switch (type) {
+               case LINE:
+                       return new Material.Line(name, key, density, true);
+                       
+               case SURFACE:
+                       return new Material.Surface(name, key, density, true);
+                       
+               case BULK:
+                       return new Material.Bulk(name, key, density, true);
+                       
+               default:
+                       throw new IllegalArgumentException("Unknown material type: " + type);
+               }
+       }
+       
+       
        
        public String toStorableString() {
                return getType().name() + "|" + key + "|" + name.replace('|', ' ') + '|' + density;