001
014
015 package com.liferay.portlet;
016
017 import com.liferay.portal.kernel.language.LanguageUtil;
018 import com.liferay.portal.kernel.util.JavaConstants;
019 import com.liferay.portal.kernel.util.StringPool;
020
021 import java.util.Enumeration;
022 import java.util.Locale;
023 import java.util.ResourceBundle;
024
025
029 public class StrutsResourceBundle extends ResourceBundle {
030
031 public StrutsResourceBundle(String portletName, Locale locale) {
032 _portletName = portletName;
033 _locale = locale;
034 }
035
036 public Enumeration<String> getKeys() {
037 return null;
038 }
039
040 public Locale getLocale() {
041 return _locale;
042 }
043
044 protected Object handleGetObject(String key) {
045 if ((key != null) &&
046 (key.equals(JavaConstants.JAVAX_PORTLET_TITLE) ||
047 key.equals(JavaConstants.JAVAX_PORTLET_SHORT_TITLE) ||
048 key.equals(JavaConstants.JAVAX_PORTLET_KEYWORDS) ||
049 key.equals(JavaConstants.JAVAX_PORTLET_DESCRIPTION))) {
050
051 key = key.concat(StringPool.PERIOD).concat(_portletName);
052 }
053
054 return LanguageUtil.get(_locale, key);
055 }
056
057 private String _portletName;
058 private Locale _locale;
059
060 }