Thread: [Jsxe-cvs] SF.net SVN: jsxe: [913] trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java
Status: Inactive
Brought to you by:
ian_lewis
From: <ian...@us...> - 2006-06-08 02:57:44
|
Revision: 913 Author: ian_lewis Date: 2006-06-07 13:05:08 -0700 (Wed, 07 Jun 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=913&view=rev Log Message: ----------- Updated javadoc Modified Paths: -------------- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java Modified: trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-06-07 06:07:44 UTC (rev 912) +++ trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-06-07 20:05:08 UTC (rev 913) @@ -49,11 +49,21 @@ //}}} /** - * Gets the messages for the current locale according to the JVM. + * Messages is the mechanism that jsXe uses to localize messages into the + * locale of the user. This class will automatically use the current default + * locale of the system but this can be overridden by calling the + * {@link #setLanguage(String)} method. + * + * Messages are automatically loaded from the properties files located in the + * 'messages' directory in the jsXe install. These files are named + * <code>message.<i>language</i></code>. Where language is the ISO-639 language + * code. The default being english. + * * @author Trish Hartnett (<a href="mailto:tri...@me...">tri...@me...</a>) * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) * @version $Id$ * @since jsXe 0.4 pre1 + * @see java.util.Locale */ public class Messages { @@ -67,7 +77,7 @@ //{{{ getLanguage() /** - * @return Returns the language. + * @return Returns the ISO-639 language code. */ public static String getLanguage() { return m_language; @@ -75,14 +85,20 @@ //{{{ setLanguage() /** - * @param newLanguage The language to set. + * @param newLanguage The ISO-639 language code */ public static void setLanguage(String newLanguage) { - initializePropertiesObject(newLanguage, m_directory); + initLocale(newLanguage, m_directory); }//}}} //{{{ getMessage() /** + * <p>Returns the message with the specified name. When a Messages is + * queried for a message it first looks for the message in the current + * language and returns it. If it cannot find the message in the messages + * for the current language it looks for it in english and returns it. If + * it still doesn't find the message it returns null.</p> + * * @param String propertyName - the name of the property you want the value for * @return Returns the value of a property from the propertiesObject. */ @@ -100,12 +116,16 @@ //{{{ getMessage() /** - * Returns the message with the specified name.<p> + * <p>Returns the message with the specified name. When a Messages is + * queried for a message it first looks for the message in the current + * language and returns it. If it cannot find the message in the messages + * for the current language it looks for it in english and returns it. If + * it still doesn't find the message it returns null.</p> * - * The elements of the <code>args</code> array are substituted + * <p>The elements of the <code>args</code> array are substituted * into the value of the property in place of strings of the * form <code>{<i>n</i>}</code>, where <code><i>n</i></code> is an index - * in the array.<p> + * in the array.</p> * * You can find out more about this feature by reading the * documentation for the <code>format</code> method of the @@ -131,13 +151,13 @@ } }//}}} - //{{{ initializePropertiesObject() + //{{{ initLocale() /** - * Initializes the localized messages for jsXe. - * This method should only be called on jsXe startup. + * Initializes localized messages for jsXe. * @param language The language for the propertiesObject. + * @param directory The directory where the messages files are located. */ - public static void initializePropertiesObject(String language, String directory) { + public static void initLocale(String language, String directory) { String isoLanguage = language; if (isoLanguage == null){ //setLanguage("en"); @@ -168,6 +188,24 @@ loadMessages(m_defaultProperties, messagesFile); }//}}} + //{{{ loadPluginMessages() + /** + * Loads the localized messages from installed plugins and merges them into + * the plugin messages. + * This method should only be called on jsXe startup. + */ + public static void loadPluginMessages(Properties pluginMessages) { + Log.log(Log.MESSAGE, Messages.class, "Loading plugin messages"); + Enumeration names = pluginMessages.propertyNames(); + while (names.hasMoreElements()) { + String name = names.nextElement().toString(); + String message = pluginMessages.getProperty(name); + m_pluginMessages.setProperty(name, message); + } + }//}}} + + //{{{ Private Members + //{{{ loadMessages() /** * @@ -185,20 +223,7 @@ Log.log(Log.ERROR, Messages.class, e); } }//}}} - - //{{{ loadPluginMessages() - /** - * Loads the localized messages from installed plugins and merges them into - * the plugin messages. - * This method should only be called on jsXe startup. - */ - public static void loadPluginMessages(Properties pluginMessages) { - Log.log(Log.MESSAGE, Messages.class, "Loading plugin messages"); - Enumeration names = pluginMessages.propertyNames(); - while (names.hasMoreElements()) { - String name = names.nextElement().toString(); - String message = pluginMessages.getProperty(name); - m_pluginMessages.setProperty(name, message); - } - }//}}} + + //}}} + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-06-25 19:12:11
|
Revision: 982 Author: ian_lewis Date: 2006-06-25 12:12:04 -0700 (Sun, 25 Jun 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=982&view=rev Log Message: ----------- Removed log MESSAGE about loading plugin messages Modified Paths: -------------- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java Modified: trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-06-25 18:55:08 UTC (rev 981) +++ trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-06-25 19:12:04 UTC (rev 982) @@ -195,7 +195,6 @@ * This method should only be called on jsXe startup. */ public static void loadPluginMessages(Properties pluginMessages) { - Log.log(Log.MESSAGE, Messages.class, "Loading plugin messages"); Enumeration names = pluginMessages.propertyNames(); while (names.hasMoreElements()) { String name = names.nextElement().toString(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-07-11 21:57:21
|
Revision: 1015 Author: ian_lewis Date: 2006-07-11 14:57:15 -0700 (Tue, 11 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1015&view=rev Log Message: ----------- fixed default locale. Accidentally checked in debug code Modified Paths: -------------- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java Modified: trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-07-11 21:54:54 UTC (rev 1014) +++ trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-07-11 21:57:15 UTC (rev 1015) @@ -88,7 +88,7 @@ */ private static Properties m_pluginMessages; - private static Locale m_locale = Locale.GERMANY; + private static Locale m_locale = Locale.getDefault(); private static boolean initialized = false; private static boolean plugins_initialized = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-07-12 20:10:43
|
Revision: 1023 Author: ian_lewis Date: 2006-07-12 13:10:38 -0700 (Wed, 12 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1023&view=rev Log Message: ----------- Checked in debug code again Modified Paths: -------------- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java Modified: trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-07-12 20:07:44 UTC (rev 1022) +++ trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-07-12 20:10:38 UTC (rev 1023) @@ -84,10 +84,10 @@ */ private static Properties m_pluginMessages; - static { - // Locale.setDefault(new Locale("sv")); - Locale.setDefault(Locale.GERMANY); - } + // static { + // // Locale.setDefault(new Locale("sv")); + // Locale.setDefault(Locale.GERMANY); + // } private static Locale m_locale = Locale.getDefault(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-07-12 22:19:16
|
Revision: 1025 Author: ian_lewis Date: 2006-07-12 15:19:13 -0700 (Wed, 12 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1025&view=rev Log Message: ----------- Debug code Modified Paths: -------------- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java Modified: trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-07-12 22:18:39 UTC (rev 1024) +++ trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-07-12 22:19:13 UTC (rev 1025) @@ -90,11 +90,11 @@ */ private static Properties m_pluginMessages; - static { - // Locale.setDefault(new Locale("sv")); - Locale.setDefault(Locale.GERMANY); - // Locale.setDefault(Locale.JAPAN); - } + // static { + // // Locale.setDefault(new Locale("sv")); + // Locale.setDefault(Locale.GERMANY); + // // Locale.setDefault(Locale.JAPAN); + // } private static Locale m_locale = Locale.getDefault(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-07-20 15:12:46
|
Revision: 1036 Author: ian_lewis Date: 2006-07-20 08:12:41 -0700 (Thu, 20 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1036&view=rev Log Message: ----------- checked in debug code Modified Paths: -------------- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java Modified: trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-07-20 15:09:38 UTC (rev 1035) +++ trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-07-20 15:12:41 UTC (rev 1036) @@ -90,11 +90,11 @@ */ private static Properties m_pluginMessages; - static { - // Locale.setDefault(new Locale("sv")); - // Locale.setDefault(Locale.GERMANY); - Locale.setDefault(Locale.JAPAN); - } + // static { + // // Locale.setDefault(new Locale("sv")); + // // Locale.setDefault(Locale.GERMANY); + // Locale.setDefault(Locale.JAPAN); + // } private static Locale m_locale = Locale.getDefault(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-03 15:23:23
|
Revision: 1098 Author: ian_lewis Date: 2006-08-03 08:23:15 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1098&view=rev Log Message: ----------- Added debug code for russian Modified Paths: -------------- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java Modified: trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-08-03 14:57:41 UTC (rev 1097) +++ trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-08-03 15:23:15 UTC (rev 1098) @@ -93,7 +93,8 @@ // static { // // Locale.setDefault(new Locale("sv")); // // Locale.setDefault(Locale.GERMANY); - // Locale.setDefault(Locale.JAPAN); + // // Locale.setDefault(Locale.JAPAN); + // Locale.setDefault(new Locale("ru", "RU")); // } private static Locale m_locale = Locale.getDefault(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |