1 /** 2 * Licensed under the Artistic License; you may not use this file 3 * except in compliance with the License. 4 * You may obtain a copy of the License at 5 * 6 * http://displaytag.sourceforge.net/license.html 7 * 8 * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR 9 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 10 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11 */ 12 package org.displaytag.localization; 13 14 import javax.servlet.jsp.PageContext; 15 import javax.servlet.jsp.tagext.Tag; 16 17 18 /** 19 * Interface for resource providers. Given a <code>resourceKey</code> and a <code>defaultValue</code>, a resource 20 * provider returns the String which should be displayed. For column headers <code>resourceKey</code> will be the 21 * value of the <code>titleKey</code> attribute, <code>defaultValue</code> will be the value of the 22 * <code>property</code> attribute. Different resource providers can be plugged using the displaytag.properties file. 23 * @author Fabrizio Giustina 24 * @version $Revision: 720 $ ($Author: fgiust $) 25 */ 26 public interface I18nResourceProvider 27 { 28 29 /** 30 * Returns a localized String. A resource provider is free to use both <code>resourceKey</code> or 31 * <code>defaultValue</code> for the lookup. For example in column titles <code>defaultValue</code> is the value 32 * of the <code>property</code> attribute and can be used as a default if <code>titleKey</code> is not 33 * specified. 34 * @param resourceKey used-specified resource key 35 * @param defaultValue default or fallback value 36 * @param tag calling tag (TableTag), which can be used to find needed ancestor tags 37 * @param context jsp page context 38 * @return localized String. 39 */ 40 String getResource(String resourceKey, String defaultValue, Tag tag, PageContext context); 41 42 } 43