KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > render > awt > viewer > Translator


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

17
18 /* $Id: Translator.java 426576 2006-07-28 15:44:37Z jeremias $ */
19  
20 package org.apache.fop.render.awt.viewer;
21
22 //Java
23
import java.util.ResourceBundle JavaDoc;
24 import java.util.Locale JavaDoc;
25
26 /**
27  * AWT Viewer's localization class, backed up by <code>java.util.ResourceBundle</code>.
28  * Originally contributed by:
29  * Stanislav.Gorkhover@jCatalog.com
30  */

31 public class Translator {
32     
33     private ResourceBundle JavaDoc bundle;
34     private static String JavaDoc bundleBaseName = "org/apache/fop/render/awt/viewer/resources/Viewer";
35
36     /**
37      * Default constructor, default <code>Locale</code> is used.
38      */

39     public Translator() {
40         this(Locale.getDefault());
41     }
42
43     /**
44      * Constructor for a given <code>Locale</code>.
45      * @param locale Locale to use
46      */

47     public Translator(Locale JavaDoc locale) {
48         bundle = ResourceBundle.getBundle(bundleBaseName, locale);
49     }
50
51     /**
52      * Returns localized <code>String</code> for a given key.
53      * @param key the key
54      * @return the localized String
55      */

56     public String JavaDoc getString(String JavaDoc key) {
57         return bundle.getString(key);
58     }
59 }
60
61
Popular Tags