001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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 Locale[] getSupportedLocales();
114    
115            public String getTimeDescription(Locale locale, long milliseconds);
116    
117            public String getTimeDescription(
118                    Locale locale, long milliseconds, boolean approximate);
119    
120            public String getTimeDescription(Locale locale, Long milliseconds);
121    
122            public String getTimeDescription(
123                    PageContext pageContext, long milliseconds);
124    
125            public String getTimeDescription(
126                    PageContext pageContext, long milliseconds, boolean approximate);
127    
128            public String getTimeDescription(
129                    PageContext pageContext, Long milliseconds);
130    
131            public void init();
132    
133            public boolean isAvailableLanguageCode(String languageCode);
134    
135            public boolean isAvailableLocale(Locale locale);
136    
137            public boolean isAvailableLocale(String languageId);
138    
139            public boolean isBetaLocale(Locale locale);
140    
141            public boolean isDuplicateLanguageCode(String languageCode);
142    
143            public void resetAvailableLocales(long companyId);
144    
145            public void updateCookie(
146                    HttpServletRequest request, HttpServletResponse response,
147                    Locale locale);
148    
149    }