KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > services > customlocalization > CustomLocalization


1 /*
2  * Copyright 2000-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.jetspeed.services.customlocalization;
17
18 import org.apache.turbine.services.TurbineServices;
19 import java.util.Locale JavaDoc;
20 import java.util.ResourceBundle JavaDoc;
21 import org.apache.turbine.util.RunData;
22
23 /**
24  * Custom Localization allows for the localization properties to changed dynamically,
25  * without shutting down the application server.
26  *
27  * @author <a HREF="mailto:massimiliano.dessi@gruppoatlantis.it">Dessė Massimiliano</a>
28  * @version $Id: CustomLocalization.java,v 1.4 2004/02/23 03:49:33 jford Exp $
29  */

30 public abstract class CustomLocalization
31 {
32
33     public CustomLocalization(){}
34
35     public static String JavaDoc getString(String JavaDoc bundleName, Locale JavaDoc locale, String JavaDoc key)
36     {
37         return getService().getString(bundleName, locale, key);
38     }
39
40     public static String JavaDoc getString(String JavaDoc key, RunData data)
41     {
42         return getService().getString(null, getLocale(data), key);
43     }
44
45     public static ResourceBundle JavaDoc getBundle( RunData data )
46     {
47         return getService().getBundle(data);
48     }
49
50     public static Locale JavaDoc getLocale(RunData data)
51     {
52         return getService().getLocale(data);
53     }
54
55     public static String JavaDoc getDefaultBundleName()
56     {
57         return getService().getDefaultBundleName();
58     }
59
60    protected static final CustomLocalizationService getService()
61     {
62         return (CustomLocalizationService) TurbineServices.getInstance().getService(CustomLocalizationService.SERVICE_NAME);
63     }
64 }
65
Popular Tags