001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.language;
016    
017    import java.util.Locale;
018    
019    import javax.portlet.PortletConfig;
020    import javax.portlet.PortletRequest;
021    
022    import javax.servlet.http.HttpServletRequest;
023    import javax.servlet.http.HttpServletResponse;
024    import javax.servlet.jsp.PageContext;
025    
026    /**
027     * @author Brian Wing Shun Chan
028     */
029    public interface Language {
030    
031            public String format(Locale locale, String pattern, Object argument);
032    
033            public String format(
034                    Locale locale, String pattern, Object argument,
035                    boolean translateArguments);
036    
037            public String format(Locale locale, String pattern, Object[] arguments);
038    
039            public String format(
040                    Locale locale, String pattern, Object[] arguments,
041                    boolean translateArguments);
042    
043            public String format(
044                    PageContext pageContext, String pattern, LanguageWrapper argument);
045    
046            public String format(
047                    PageContext pageContext, String pattern, LanguageWrapper argument,
048                    boolean translateArguments);
049    
050            public String format(
051                    PageContext pageContext, String pattern, LanguageWrapper[] arguments);
052    
053            public String format(
054                    PageContext pageContext, String pattern, LanguageWrapper[] arguments,
055                    boolean translateArguments);
056    
057            public String format(
058                    PageContext pageContext, String pattern, Object argument);
059    
060            public String format(
061                    PageContext pageContext, String pattern, Object argument,
062                    boolean translateArguments);
063    
064            public String format(
065                    PageContext pageContext, String pattern, Object[] arguments);
066    
067            public String format(
068                    PageContext pageContext, String pattern, Object[] arguments,
069                    boolean translateArguments);
070    
071            public String format(
072                    PortletConfig portletConfig, Locale locale, String pattern,
073                    Object argument);
074    
075            public String format(
076                    PortletConfig portletConfig, Locale locale, String pattern,
077                    Object argument, boolean translateArguments);
078    
079            public String format(
080                    PortletConfig portletConfig, Locale locale, String pattern,
081                    Object[] arguments);
082    
083            public String format(
084                    PortletConfig portletConfig, Locale locale, String pattern,
085                    Object[] arguments, boolean translateArguments);
086    
087            public String get(Locale locale, String key);
088    
089            public String get(Locale locale, String key, String defaultValue);
090    
091            public String get(PageContext pageContext, String key);
092    
093            public String get(PageContext pageContext, String key, String defaultValue);
094    
095            public String get(PortletConfig portletConfig, Locale locale, String key);
096    
097            public String get(
098                    PortletConfig portletConfig, Locale locale, String key,
099                    String defaultValue);
100    
101            public Locale[] getAvailableLocales();
102    
103            public String getCharset(Locale locale);
104    
105            public String getLanguageId(HttpServletRequest request);
106    
107            public String getLanguageId(Locale locale);
108    
109            public String getLanguageId(PortletRequest portletRequest);
110    
111            public Locale getLocale(String languageCode);
112    
113            public String getTimeDescription(
114                    PageContext pageContext, long milliseconds);
115    
116            public String getTimeDescription(
117                    PageContext pageContext, Long milliseconds);
118    
119            public void init();
120    
121            public boolean isAvailableLocale(Locale locale);
122    
123            public boolean isDuplicateLanguageCode(String languageCode);
124    
125            public void resetAvailableLocales(long companyId);
126    
127            public void updateCookie(
128                    HttpServletRequest request, HttpServletResponse response,
129                    Locale locale);
130    
131    }