commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dflo...@apache.org
Subject svn commit: r154315 - jakarta/commons/sandbox/i18n/trunk/src/examples/org/apache/i18n/examples/ResourceBundleExample.java
Date Fri, 18 Feb 2005 15:22:39 GMT
Author: dflorey
Date: Fri Feb 18 07:22:38 2005
New Revision: 154315

URL: http://svn.apache.org/viewcvs?view=rev&rev=154315
Log:
Updated example

Modified:
    jakarta/commons/sandbox/i18n/trunk/src/examples/org/apache/i18n/examples/ResourceBundleExample.java

Modified: jakarta/commons/sandbox/i18n/trunk/src/examples/org/apache/i18n/examples/ResourceBundleExample.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/i18n/trunk/src/examples/org/apache/i18n/examples/ResourceBundleExample.java?view=diff&r1=154314&r2=154315
==============================================================================
--- jakarta/commons/sandbox/i18n/trunk/src/examples/org/apache/i18n/examples/ResourceBundleExample.java
(original)
+++ jakarta/commons/sandbox/i18n/trunk/src/examples/org/apache/i18n/examples/ResourceBundleExample.java
Fri Feb 18 07:22:38 2005
@@ -19,8 +19,10 @@
 */
 package org.apache.i18n.examples;
 
-import org.apache.commons.i18n.LocalizedMessage;
-import org.apache.commons.i18n.ResourceBundleMessageProvider;
+import java.util.Locale;
+
+import org.apache.commons.i18n.XMLMessageProvider;
+import org.apache.commons.i18n.bundles.MessageBundle;
 
 /**
  * @author Daniel Florey
@@ -28,9 +30,9 @@
  */
 public class ResourceBundleExample {
     public static void main(String[] args) {
-        ResourceBundleMessageProvider.install("messageBundle");
-        LocalizedMessage testMessage = new LocalizedMessage("helloWorld");
-        System.out.println(testMessage.getTitle());
-        System.out.println(testMessage.getText());
+        XMLMessageProvider.install("org.apache.commons-i18n.test", Thread.currentThread().getContextClassLoader().getResourceAsStream("testMessages.xml"));
+        MessageBundle xmlMessage = new MessageBundle("helloWorld");
+        System.out.println(xmlMessage.getTitle(Locale.GERMAN));
+        System.out.println(xmlMessage.getText(Locale.GERMAN));
     }
-}
+}
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message