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.List;
018    import java.util.Locale;
019    
020    import javax.portlet.PortletConfig;
021    import javax.portlet.PortletRequest;
022    
023    import javax.servlet.http.HttpServletRequest;
024    import javax.servlet.http.HttpServletResponse;
025    import javax.servlet.jsp.PageContext;
026    
027    /**
028     * @author Brian Wing Shun Chan
029     */
030    public interface Language {
031    
032            public String format(Locale locale, String pattern, List<Object> arguments);
033    
034            public String format(Locale locale, String pattern, Object argument);
035    
036            public String format(
037                    Locale locale, String pattern, Object argument,
038                    boolean translateArguments);
039    
040            public String format(Locale locale, String pattern, Object[] arguments);
041    
042            public String format(
043                    Locale locale, String pattern, Object[] arguments,
044                    boolean translateArguments);
045    
046            public String format(
047                    PageContext pageContext, String pattern, LanguageWrapper argument);
048    
049            public String format(
050                    PageContext pageContext, String pattern, LanguageWrapper argument,
051                    boolean translateArguments);
052    
053            public String format(
054                    PageContext pageContext, String pattern, LanguageWrapper[] arguments);
055    
056            public String format(
057                    PageContext pageContext, String pattern, LanguageWrapper[] arguments,
058                    boolean translateArguments);
059    
060            public String format(
061                    PageContext pageContext, String pattern, Object argument);
062    
063            public String format(
064                    PageContext pageContext, String pattern, Object argument,
065                    boolean translateArguments);
066    
067            public String format(
068                    PageContext pageContext, String pattern, Object[] arguments);
069    
070            public String format(
071                    PageContext pageContext, String pattern, Object[] arguments,
072                    boolean translateArguments);
073    
074            public String format(
075                    PortletConfig portletConfig, Locale locale, String pattern,
076                    Object argument);
077    
078            public String format(
079                    PortletConfig portletConfig, Locale locale, String pattern,
080                    Object argument, boolean translateArguments);
081    
082            public String format(
083                    PortletConfig portletConfig, Locale locale, String pattern,
084                    Object[] arguments);
085    
086            public String format(
087                    PortletConfig portletConfig, Locale locale, String pattern,
088                    Object[] arguments, boolean translateArguments);
089    
090            public String get(Locale locale, String key);
091    
092            public String get(Locale locale, String key, String defaultValue);
093    
094            public String get(PageContext pageContext, String key);
095    
096            public String get(PageContext pageContext, String key, String defaultValue);
097    
098            public String get(PortletConfig portletConfig, Locale locale, String key);
099    
100            public String get(
101                    PortletConfig portletConfig, Locale locale, String key,
102                    String defaultValue);
103    
104            public Locale[] getAvailableLocales();
105    
106            public String getCharset(Locale locale);
107    
108            public String getLanguageId(HttpServletRequest request);
109    
110            public String getLanguageId(Locale locale);
111    
112            public String getLanguageId(PortletRequest portletRequest);
113    
114            public Locale getLocale(String languageCode);
115    
116            public Locale[] getSupportedLocales();
117    
118            public String getTimeDescription(Locale locale, long milliseconds);
119    
120            public String getTimeDescription(
121                    Locale locale, long milliseconds, boolean approximate);
122    
123            public String getTimeDescription(Locale locale, Long milliseconds);
124    
125            public String getTimeDescription(
126                    PageContext pageContext, long milliseconds);
127    
128            public String getTimeDescription(
129                    PageContext pageContext, long milliseconds, boolean approximate);
130    
131            public String getTimeDescription(
132                    PageContext pageContext, Long milliseconds);
133    
134            public void init();
135    
136            public boolean isAvailableLanguageCode(String languageCode);
137    
138            public boolean isAvailableLocale(Locale locale);
139    
140            public boolean isBetaLocale(Locale locale);
141    
142            public boolean isDuplicateLanguageCode(String languageCode);
143    
144            public void resetAvailableLocales(long companyId);
145    
146            public void updateCookie(
147                    HttpServletRequest request, HttpServletResponse response,
148                    Locale locale);
149    
150    }