Initial i18n support, bug fixes
This commit is contained in:
		
							parent
							
								
									b1a1126837
								
							
						
					
					
						commit
						a55b0c6a80
					
				
							
								
								
									
										16
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								ChangeLog
									
									
									
									
									
								
							| @ -1,3 +1,17 @@ | |||||||
|  | 2011-01-20  Sampo Niskanen | ||||||
|  | 
 | ||||||
|  | 	* Initial i18n support | ||||||
|  | 
 | ||||||
|  | 2011-01-18  Sampo Niskanen | ||||||
|  | 
 | ||||||
|  | 	* [BUG] Simulation warnings were not being stored | ||||||
|  | 	* [BUG] Exclamation mark did not fit in simulation table | ||||||
|  | 	* Added instructions for zooming in plot dialog | ||||||
|  | 
 | ||||||
|  | 2010-12-01  Doug Pedrick | ||||||
|  | 
 | ||||||
|  | 	* Merging printing support | ||||||
|  | 
 | ||||||
| 2010-10-30  Sampo Niskanen | 2010-10-30  Sampo Niskanen | ||||||
| 
 | 
 | ||||||
| 	* [BUG] Invalid refereces to components used in caches | 	* [BUG] Invalid refereces to components used in caches | ||||||
| @ -6,7 +20,7 @@ | |||||||
| 
 | 
 | ||||||
| 	* [BUG] Take launch lug radial angle into account when loading rkt file | 	* [BUG] Take launch lug radial angle into account when loading rkt file | ||||||
| 
 | 
 | ||||||
| 2010-10-24  Sampo Niskane | 2010-10-24  Sampo Niskanen | ||||||
| 
 | 
 | ||||||
| 	* Added SafetyMutex and took into use in Simulation | 	* Added SafetyMutex and took into use in Simulation | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -4,6 +4,10 @@ | |||||||
| # | # | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | ! Set to the name of the current translation file (used for debugging purposes) | ||||||
|  | debug.currentFile = messages.properties | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| ! Labels used in buttons of dialog windows | ! Labels used in buttons of dialog windows | ||||||
| button.ok = OK | button.ok = OK | ||||||
| button.cancel = Cancel | button.cancel = Cancel | ||||||
|  | |||||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 185 KiB | 
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 185 KiB | 
							
								
								
									
										2
									
								
								run.sh
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								run.sh
									
									
									
									
									
								
							| @ -14,5 +14,5 @@ while echo "$1" | grep -q "^-" ; do | |||||||
| done | done | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| java -cp bin/:lib/miglayout15-swing.jar:lib/jcommon-1.0.16.jar:lib/jfreechart-1.0.13.jar:. $JAVAOPTS net.sf.openrocket.startup.Startup "$@" | java -cp bin/:lib/miglayout15-swing.jar:lib/jcommon-1.0.16.jar:lib/jfreechart-1.0.13.jar:lib/iText-5.0.2.jar:. $JAVAOPTS net.sf.openrocket.startup.Startup "$@" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -254,7 +254,7 @@ public class SimulationPanel extends JPanel { | |||||||
| 					 | 					 | ||||||
| 					@Override | 					@Override | ||||||
| 					public int getExactWidth() { | 					public int getExactWidth() { | ||||||
| 						return 32; | 						return 36; | ||||||
| 					} | 					} | ||||||
| 					 | 					 | ||||||
| 					@Override | 					@Override | ||||||
|  | |||||||
| @ -27,10 +27,12 @@ import javax.swing.BorderFactory; | |||||||
| import javax.swing.JButton; | import javax.swing.JButton; | ||||||
| import javax.swing.JCheckBox; | import javax.swing.JCheckBox; | ||||||
| import javax.swing.JDialog; | import javax.swing.JDialog; | ||||||
|  | import javax.swing.JLabel; | ||||||
| import javax.swing.JPanel; | import javax.swing.JPanel; | ||||||
| 
 | 
 | ||||||
| import net.miginfocom.swing.MigLayout; | import net.miginfocom.swing.MigLayout; | ||||||
| import net.sf.openrocket.document.Simulation; | import net.sf.openrocket.document.Simulation; | ||||||
|  | import net.sf.openrocket.gui.components.StyledLabel; | ||||||
| import net.sf.openrocket.simulation.FlightDataBranch; | import net.sf.openrocket.simulation.FlightDataBranch; | ||||||
| import net.sf.openrocket.simulation.FlightDataType; | import net.sf.openrocket.simulation.FlightDataType; | ||||||
| import net.sf.openrocket.simulation.FlightEvent; | import net.sf.openrocket.simulation.FlightEvent; | ||||||
| @ -417,6 +419,11 @@ public class PlotDialog extends JDialog { | |||||||
| 		}); | 		}); | ||||||
| 		panel.add(check, "split, left"); | 		panel.add(check, "split, left"); | ||||||
| 		 | 		 | ||||||
|  | 
 | ||||||
|  | 		JLabel label = new StyledLabel("Click+drag down+right to zoom in, up+left to zoom out", -2); | ||||||
|  | 		panel.add(label, "gapleft para"); | ||||||
|  | 		 | ||||||
|  | 
 | ||||||
| 		panel.add(new JPanel(), "growx"); | 		panel.add(new JPanel(), "growx"); | ||||||
| 		 | 		 | ||||||
| 		JButton button = new JButton("Close"); | 		JButton button = new JButton("Close"); | ||||||
|  | |||||||
| @ -6,7 +6,6 @@ import java.util.Set; | |||||||
| 
 | 
 | ||||||
| import net.sf.openrocket.aerodynamics.FlightConditions; | import net.sf.openrocket.aerodynamics.FlightConditions; | ||||||
| import net.sf.openrocket.aerodynamics.Warning; | import net.sf.openrocket.aerodynamics.Warning; | ||||||
| import net.sf.openrocket.aerodynamics.WarningSet; |  | ||||||
| import net.sf.openrocket.logging.LogHelper; | import net.sf.openrocket.logging.LogHelper; | ||||||
| import net.sf.openrocket.motor.Motor; | import net.sf.openrocket.motor.Motor; | ||||||
| import net.sf.openrocket.motor.MotorId; | import net.sf.openrocket.motor.MotorId; | ||||||
| @ -57,7 +56,7 @@ public class BasicEventSimulationEngine implements SimulationEngine { | |||||||
| 		 | 		 | ||||||
| 		// Initialize the simulation | 		// Initialize the simulation | ||||||
| 		currentStepper = flightStepper; | 		currentStepper = flightStepper; | ||||||
| 		status = initialStatus(configuration, motorConfiguration, simulationConditions); | 		status = initialStatus(configuration, motorConfiguration, simulationConditions, flightData); | ||||||
| 		status = currentStepper.initialize(status); | 		status = currentStepper.initialize(status); | ||||||
| 		 | 		 | ||||||
| 
 | 
 | ||||||
| @ -161,7 +160,7 @@ public class BasicEventSimulationEngine implements SimulationEngine { | |||||||
| 
 | 
 | ||||||
| 	private SimulationStatus initialStatus(Configuration configuration, | 	private SimulationStatus initialStatus(Configuration configuration, | ||||||
| 			MotorInstanceConfiguration motorConfiguration, | 			MotorInstanceConfiguration motorConfiguration, | ||||||
| 			SimulationConditions simulationConditions) { | 			SimulationConditions simulationConditions, FlightData flightData) { | ||||||
| 		 | 		 | ||||||
| 		SimulationStatus init = new SimulationStatus(); | 		SimulationStatus init = new SimulationStatus(); | ||||||
| 		init.setSimulationConditions(simulationConditions); | 		init.setSimulationConditions(simulationConditions); | ||||||
| @ -227,7 +226,7 @@ public class BasicEventSimulationEngine implements SimulationEngine { | |||||||
| 		init.getEventQueue().add(new FlightEvent(FlightEvent.Type.LAUNCH, 0, simulationConditions.getRocket())); | 		init.getEventQueue().add(new FlightEvent(FlightEvent.Type.LAUNCH, 0, simulationConditions.getRocket())); | ||||||
| 		 | 		 | ||||||
| 		init.setFlightData(new FlightDataBranch("MAIN", FlightDataType.TYPE_TIME)); | 		init.setFlightData(new FlightDataBranch("MAIN", FlightDataType.TYPE_TIME)); | ||||||
| 		init.setWarnings(new WarningSet()); | 		init.setWarnings(flightData.getWarningSet()); | ||||||
| 		 | 		 | ||||||
| 		return init; | 		return init; | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -6,6 +6,7 @@ import java.awt.event.ActionListener; | |||||||
| import java.io.File; | import java.io.File; | ||||||
| import java.io.PrintStream; | import java.io.PrintStream; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  | import java.util.Locale; | ||||||
| import java.util.concurrent.atomic.AtomicInteger; | import java.util.concurrent.atomic.AtomicInteger; | ||||||
| 
 | 
 | ||||||
| import javax.swing.JOptionPane; | import javax.swing.JOptionPane; | ||||||
| @ -26,6 +27,9 @@ import net.sf.openrocket.gui.main.BasicFrame; | |||||||
| import net.sf.openrocket.gui.main.ExceptionHandler; | import net.sf.openrocket.gui.main.ExceptionHandler; | ||||||
| import net.sf.openrocket.gui.main.SimpleFileFilter; | import net.sf.openrocket.gui.main.SimpleFileFilter; | ||||||
| import net.sf.openrocket.gui.main.Splash; | import net.sf.openrocket.gui.main.Splash; | ||||||
|  | import net.sf.openrocket.l10n.DebugTranslator; | ||||||
|  | import net.sf.openrocket.l10n.ResourceBundleTranslator; | ||||||
|  | import net.sf.openrocket.l10n.Translator; | ||||||
| import net.sf.openrocket.logging.DelegatorLogger; | import net.sf.openrocket.logging.DelegatorLogger; | ||||||
| import net.sf.openrocket.logging.LogHelper; | import net.sf.openrocket.logging.LogHelper; | ||||||
| import net.sf.openrocket.logging.LogLevel; | import net.sf.openrocket.logging.LogLevel; | ||||||
| @ -68,6 +72,9 @@ public class Startup { | |||||||
| 		// Initialize logging first so we can use it | 		// Initialize logging first so we can use it | ||||||
| 		initializeLogging(); | 		initializeLogging(); | ||||||
| 		 | 		 | ||||||
|  | 		// Setup the translations | ||||||
|  | 		initializeL10n(); | ||||||
|  | 		 | ||||||
| 		// Check that we have a head | 		// Check that we have a head | ||||||
| 		checkHead(); | 		checkHead(); | ||||||
| 		 | 		 | ||||||
| @ -94,6 +101,7 @@ public class Startup { | |||||||
| 	 | 	 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| 	private static void checkDebugStatus() { | 	private static void checkDebugStatus() { | ||||||
| 		if (System.getProperty("openrocket.debug") != null) { | 		if (System.getProperty("openrocket.debug") != null) { | ||||||
| 			System.setProperty("openrocket.log.stdout", "VBOSE"); | 			System.setProperty("openrocket.log.stdout", "VBOSE"); | ||||||
| @ -105,6 +113,37 @@ public class Startup { | |||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	 | 	 | ||||||
|  | 	/** | ||||||
|  | 	 * Initializes the localization system. | ||||||
|  | 	 */ | ||||||
|  | 	private static void initializeL10n() { | ||||||
|  | 		String locale = System.getProperty("openrocket.locale"); | ||||||
|  | 		if (locale != null) { | ||||||
|  | 			Locale l; | ||||||
|  | 			String[] split = locale.split("[_-]", 3); | ||||||
|  | 			if (split.length == 1) { | ||||||
|  | 				l = new Locale(split[0]); | ||||||
|  | 			} else if (split.length == 2) { | ||||||
|  | 				l = new Locale(split[0], split[1]); | ||||||
|  | 			} else { | ||||||
|  | 				l = new Locale(split[0], split[1], split[2]); | ||||||
|  | 			} | ||||||
|  | 			Locale.setDefault(l); | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
|  | 		Translator t; | ||||||
|  | 		if (Locale.getDefault().getLanguage().equals("xx")) { | ||||||
|  | 			t = new DebugTranslator(); | ||||||
|  | 		} else { | ||||||
|  | 			t = new ResourceBundleTranslator("l10n.messages"); | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
|  | 		log.info("Set up translation for locale " + Locale.getDefault() + | ||||||
|  | 				", debug.currentFile=" + t.get("debug.currentFile")); | ||||||
|  | 		 | ||||||
|  | 		Application.setTranslator(t); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
| 	 | 	 | ||||||
| 
 | 
 | ||||||
| 	private static void runMain(String[] args) { | 	private static void runMain(String[] args) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user