Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 37085 invoked from network); 18 Dec 2004 15:24:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 18 Dec 2004 15:24:05 -0000 Received: (qmail 97451 invoked by uid 500); 18 Dec 2004 15:23:16 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 97180 invoked by uid 500); 18 Dec 2004 15:23:12 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 96820 invoked by uid 500); 18 Dec 2004 15:23:09 -0000 Received: (qmail 96391 invoked by uid 99); 18 Dec 2004 15:23:04 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Sat, 18 Dec 2004 07:23:02 -0800 Received: (qmail 35694 invoked by uid 1823); 18 Dec 2004 15:23:01 -0000 Date: 18 Dec 2004 15:23:01 -0000 Message-ID: <20041218152301.35693.qmail@minotaur.apache.org> From: dflorey@apache.org To: jakarta-commons-sandbox-cvs@apache.org Subject: cvs commit: jakarta-commons-sandbox/i18n/src/java/org/apache/commons/i18n ResourceBundleMessageProvider.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org