dflorey 2004/12/18 07:23:01 Modified: i18n/src/java/org/apache/commons/i18n ResourceBundleMessageProvider.java Added: i18n/src/examples/org/apache/i18n/examples ResourceBundleExample.java i18n/src/examples messageBundle_de.properties messageBundle.properties Log: Added support for pluggable MessageProviders and added ResourceBundleMessageProvider to enable migration from resource bundle based applications to i18n. Revision Changes Path 1.1 jakarta-commons-sandbox/i18n/src/examples/org/apache/i18n/examples/ResourceBundleExample.java Index: ResourceBundleExample.java =================================================================== /* * * ==================================================================== * * Copyright 2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package org.apache.i18n.examples; import org.apache.commons.i18n.LocalizedMessage; import org.apache.commons.i18n.ResourceBundleMessageProvider; /** * @author Daniel Florey * */ 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()); } } 1.1 jakarta-commons-sandbox/i18n/src/examples/messageBundle_de.properties Index: messageBundle_de.properties =================================================================== # Example for using message bundles using a flat properties-file helloWorld.title=Hallo Welt helloWorld.text=Ich wünsche Dir alles Gute und ein frohes Fest! 1.1 jakarta-commons-sandbox/i18n/src/examples/messageBundle.properties Index: messageBundle.properties =================================================================== # Example for using message bundles using a flat properties-file helloWorld.title=Hello World helloWorld.text=I wish you a merry christmas! 1.2 +1 -1 jakarta-commons-sandbox/i18n/src/java/org/apache/commons/i18n/ResourceBundleMessageProvider.java Index: ResourceBundleMessageProvider.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/i18n/src/java/org/apache/commons/i18n/ResourceBundleMessageProvider.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ResourceBundleMessageProvider.java 18 Dec 2004 15:08:49 -0000 1.1 +++ ResourceBundleMessageProvider.java 18 Dec 2004 15:23:01 -0000 1.2 @@ -54,7 +54,7 @@ } } catch ( MissingResourceException e ) { logger.log(Level.WARNING, "Could not find resource bundle with base name '"+baseName+"', uninstalling it..."); - uninstall(baseName); + i.remove(); } } throw new MessageNotFoundException("Message with id "+id+" not found");
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]