1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet;
16  
17  import com.liferay.portal.kernel.language.LanguageUtil;
18  import com.liferay.portal.kernel.util.JavaConstants;
19  import com.liferay.portal.kernel.util.StringPool;
20  
21  import java.util.Enumeration;
22  import java.util.Locale;
23  import java.util.ResourceBundle;
24  
25  /**
26   * <a href="StrutsResourceBundle.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   * @author Eduardo Lundgren
30   */
31  public class StrutsResourceBundle extends ResourceBundle {
32  
33      public StrutsResourceBundle(String portletName, Locale locale) {
34          _portletName = portletName;
35          _locale = locale;
36      }
37  
38      public Enumeration<String> getKeys() {
39          return null;
40      }
41  
42      public Locale getLocale() {
43          return _locale;
44      }
45  
46      protected Object handleGetObject(String key) {
47          if ((key != null) &&
48              (key.equals(JavaConstants.JAVAX_PORTLET_TITLE) ||
49               key.equals(JavaConstants.JAVAX_PORTLET_SHORT_TITLE) ||
50               key.equals(JavaConstants.JAVAX_PORTLET_KEYWORDS) ||
51               key.equals(JavaConstants.JAVAX_PORTLET_DESCRIPTION))) {
52  
53              key = key.concat(StringPool.PERIOD).concat(_portletName);
54          }
55  
56          return LanguageUtil.get(_locale, key);
57      }
58  
59      private String _portletName;
60      private Locale _locale;
61  
62  }