-------- Original-Nachricht --------
Betreff: [Freemind-cvslog] freemind/freemind/main FreeMindStarter.java, 1.1.2.1, 1.1.2.2
Datum: Mon, 26 May 2008 20:50:28 +0000
Von: Dimitry Polivaev <dpolivaev@users.sourceforge.net>
An: freemind-cvslog@lists.sourceforge.net
Hi Dimitry,

what issue is exactly addressed by this change? Isn't it early enough to do it in FreeMind line 249?
Observe, that you doubled the code to read the preferences and that they are read twice, now.
And, if this is really necessary, then I would propose to pass the read prefs to FreeMind.main such
that it is not read again.

Regards, Chris

Update of /cvsroot/freemind/freemind/freemind/main
In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv32635

Modified Files:
      Tag: fm_060405_integration
	FreeMindStarter.java 
Log Message:
Call Locale.setDefault(Locale) before awt.Toolkit is initialised 
for displaying of accelerator keys in selected language.

This solution is not perfect but just better than nothing.

Index: FreeMindStarter.java
===================================================================
RCS file: /cvsroot/freemind/freemind/freemind/main/Attic/FreeMindStarter.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** FreeMindStarter.java	7 Jul 2006 04:26:26 -0000	1.1.2.1
--- FreeMindStarter.java	26 May 2008 20:50:25 -0000	1.1.2.2
***************
*** 23,26 ****
--- 23,33 ----
  package freemind.main;
  
+ import java.io.File;
+ import java.io.FileInputStream;
+ import java.io.InputStream;
+ import java.net.URL;
+ import java.util.Locale;
+ import java.util.Properties;
+ 
  import javax.swing.JOptionPane;
  
***************
*** 51,55 ****
--- 58,104 ----
  		// First check version of Java
  		FreeMindStarter.checkJavaVersion();
+ 		setDefaultLocale();
  		FreeMind.main(args);
  	}
+ 
+ 	/**
+ 	 */
+ 	private static void setDefaultLocale() {
+ 		String propsLoc = "freemind.properties";
+ 		URL defaultPropsURL = ClassLoader.getSystemResource(propsLoc);
+ 		Properties props = new Properties();
+ 		try {
+ 			InputStream in = null;
+ 			in = defaultPropsURL.openStream();
+ 			props.load(in);
+ 			in.close();
+ 			String freemindDirectory = System.getProperty("user.home") + File.separator +  props.getProperty("properties_folder");
+ 			File userPropertiesFolder = new File(freemindDirectory);
+ 			File autoPropertiesFile = new File(userPropertiesFolder, props.getProperty("autoproperties"));
+ 			in = new FileInputStream(autoPropertiesFile);
+ 			Properties auto = new Properties(props);
+ 			auto.load(in);
+ 			in.close();
+ 			String lang = auto.getProperty(FreeMindCommon.RESOURCE_LANGUAGE);
+ 			if(lang == null){
+ 				return;
+ 			}
+ 			Locale localeDef = null;
+ 			switch(lang.length()){
+ 			case 2:
+ 				localeDef = new Locale(lang);
+ 				break;
+ 			case 5:
+ 				localeDef =new Locale(lang.substring(0, 1), lang.substring(3, 4));
+ 				break;
+ 			default:
+ 				return;	
+ 			}
+ 			Locale.setDefault(localeDef);
+ 		} catch (Exception ex) {
+ 			ex.printStackTrace();
+ 			System.err
+ 					.println("Panic! Error while loading default properties.");
+ 		}
+ 		}
  }


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freemind-cvslog mailing list
Freemind-cvslog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freemind-cvslog