View Javadoc

1   /**
2    * Copyright 2007 Art Technology Group, Inc (ATG)
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    *
7    * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and limitations under the License.
13   */
14  
15  package atg.taglib.json;
16  
17  import java.util.MissingResourceException;
18  import java.util.ResourceBundle;
19  
20  /**
21   * i18n Messages Implementation (provided by Eclipse)
22   *
23   * @author James Wiltshire
24   * @version $Id$
25   */
26  
27  public class Messages
28  {
29    private static final String BUNDLE_NAME = "atg.taglib.json.messages"; //$NON-NLS-1$
30  
31    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
32  
33    private Messages()
34    {
35      // Can't be instantiated
36    }
37  
38    public static String getString(String key)
39    {
40      try {
41        return RESOURCE_BUNDLE.getString(key);
42      }
43      catch (MissingResourceException e) {
44        return '!' + key + '!';
45      }
46    }
47  }