dgraham 2003/03/19 11:02:07
Modified: resources/src/java overview.html
resources/src/java/org/apache/commons/resources
Messages.java
resources/src/test/org/apache/commons/resources
MessagesTestCase.java
Log:
Removed hardcoded dependency on the properties file name "LocalStrings"
to allow users to name their resources however they like.
Revision Changes Path
1.3 +3 -3 jakarta-commons-sandbox/resources/src/java/overview.html
Index: overview.html
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/overview.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- overview.html 7 Jan 2003 02:40:52 -0000 1.2
+++ overview.html 19 Mar 2003 19:02:07 -0000 1.3
@@ -256,7 +256,7 @@
public class MyClass {
private static Messages messages =
- Messages.getMessages("com.mycompany.mypackage");
+ Messages.getMessages("com.mycompany.mypackage.LocalStrings");
public class do() {
@@ -272,8 +272,8 @@
</pre>
<p>The <code>getMessages()</code> method acquires an instance of
-<code>ResourceBundleResources</code> for a resource bundle named
-<code>LocalStrings</code> in the package you specify (normally the
+<code>ResourceBundleResources</code> for a resource bundle with the package
+and name you specify (normally the
package containing this class) on the class path for your application.
Most people will find it convenient to specify the actual resources
with property files that are included in the JAR file (or directory)
1.4 +9 -9
jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/Messages.java
Index: Messages.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/Messages.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Messages.java 6 Mar 2003 03:24:25 -0000 1.3
+++ Messages.java 19 Mar 2003 19:02:07 -0000 1.4
@@ -584,15 +584,15 @@
/**
* <p>Convenience factory method to create a [EMAIL PROTECTED] Messages}
instance
* that wraps a [EMAIL PROTECTED] Resources} instance that contains message
resources
- * for the specified Java package. It is expected that the resources
+ * for the specified properties file. It is expected that the resources
* for each package will be in properties files that are nested in the
- * package directory, with the name <code>LocalStrings.properties</code>
+ * package directory, with names like <code>LocalStrings.properties</code>
* for the default messages, and names like
* <code>LocalStrings_en_US.properties</code> for messages localized to
* a particular <code>Locale</code>.</p>
*
- * @param name Package name of the Java package for which
- * local message resources are desired
+ * @param name Package + file name of the properties file for which
+ * local message resources are desired (ie.
org.apache.commons.resources.LocalStrings).
*/
public static Messages getMessages(String name) {
@@ -600,7 +600,7 @@
factory = new ResourceBundleResourcesFactory();
}
try {
- Resources resources = factory.getResources(name + ".LocalStrings");
+ Resources resources = factory.getResources(name);
return (new Messages(resources));
} catch (ResourcesException e) {
return (null);
1.4 +6 -6
jakarta-commons-sandbox/resources/src/test/org/apache/commons/resources/MessagesTestCase.java
Index: MessagesTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/resources/src/test/org/apache/commons/resources/MessagesTestCase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MessagesTestCase.java 28 Feb 2003 02:55:00 -0000 1.3
+++ MessagesTestCase.java 19 Mar 2003 19:02:07 -0000 1.4
@@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -142,7 +142,7 @@
public void testLocal() {
String message = null;
Messages local =
- Messages.getMessages("org.apache.commons.resources.impl");
+ Messages.getMessages("org.apache.commons.resources.impl.LocalStrings");
assertNotNull("Local messages found", local);
message = local.getMessage("local.message");
assertEquals("Correct individual message",
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]