001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.exception.PortalException;
020    
021    import java.util.List;
022    import java.util.Locale;
023    import java.util.ResourceBundle;
024    
025    import javax.portlet.PortletRequest;
026    
027    import javax.servlet.http.HttpServletRequest;
028    import javax.servlet.http.HttpServletResponse;
029    
030    /**
031     * @author Brian Wing Shun Chan
032     */
033    @ProviderType
034    public interface Language {
035    
036            public String format(
037                    HttpServletRequest request, String pattern, LanguageWrapper argument);
038    
039            public String format(
040                    HttpServletRequest request, String pattern, LanguageWrapper argument,
041                    boolean translateArguments);
042    
043            public String format(
044                    HttpServletRequest request, String pattern,
045                    LanguageWrapper[] arguments);
046    
047            public String format(
048                    HttpServletRequest request, String pattern, LanguageWrapper[] arguments,
049                    boolean translateArguments);
050    
051            public String format(
052                    HttpServletRequest request, String pattern, Object argument);
053    
054            public String format(
055                    HttpServletRequest request, String pattern, Object argument,
056                    boolean translateArguments);
057    
058            public String format(
059                    HttpServletRequest request, String pattern, Object[] arguments);
060    
061            public String format(
062                    HttpServletRequest request, String pattern, Object[] arguments,
063                    boolean translateArguments);
064    
065            public String format(Locale locale, String pattern, List<Object> arguments);
066    
067            public String format(Locale locale, String pattern, Object argument);
068    
069            public String format(
070                    Locale locale, String pattern, Object argument,
071                    boolean translateArguments);
072    
073            public String format(Locale locale, String pattern, Object[] arguments);
074    
075            public String format(
076                    Locale locale, String pattern, Object[] arguments,
077                    boolean translateArguments);
078    
079            public String format(
080                    ResourceBundle resourceBundle, String pattern, Object argument);
081    
082            public String format(
083                    ResourceBundle resourceBundle, String pattern, Object argument,
084                    boolean translateArguments);
085    
086            public String format(
087                    ResourceBundle resourceBundle, String pattern, Object[] arguments);
088    
089            public String format(
090                    ResourceBundle resourceBundle, String pattern, Object[] arguments,
091                    boolean translateArguments);
092    
093            public String get(HttpServletRequest request, String key);
094    
095            public String get(
096                    HttpServletRequest request, String key, String defaultValue);
097    
098            public String get(Locale locale, String key);
099    
100            public String get(Locale locale, String key, String defaultValue);
101    
102            public String get(ResourceBundle resourceBundle, String key);
103    
104            public String get(
105                    ResourceBundle resourceBundle, String key, String defaultValue);
106    
107            public Locale[] getAvailableLocales();
108    
109            public Locale[] getAvailableLocales(long groupId);
110    
111            public String getBCP47LanguageId(HttpServletRequest request);
112    
113            public String getBCP47LanguageId(Locale locale);
114    
115            public String getBCP47LanguageId(PortletRequest portletRequest);
116    
117            public String getCharset(Locale locale);
118    
119            public String getLanguageId(HttpServletRequest request);
120    
121            public String getLanguageId(Locale locale);
122    
123            public String getLanguageId(PortletRequest portletRequest);
124    
125            public Locale getLocale(String languageCode);
126    
127            public Locale[] getSupportedLocales();
128    
129            public String getTimeDescription(
130                    HttpServletRequest request, long milliseconds);
131    
132            public String getTimeDescription(
133                    HttpServletRequest request, long milliseconds, boolean approximate);
134    
135            public String getTimeDescription(
136                    HttpServletRequest request, Long milliseconds);
137    
138            public String getTimeDescription(Locale locale, long milliseconds);
139    
140            public String getTimeDescription(
141                    Locale locale, long milliseconds, boolean approximate);
142    
143            public String getTimeDescription(Locale locale, Long milliseconds);
144    
145            public void init();
146    
147            public boolean isAvailableLanguageCode(String languageCode);
148    
149            public boolean isAvailableLocale(Locale locale);
150    
151            public boolean isAvailableLocale(long groupId, Locale locale);
152    
153            public boolean isAvailableLocale(long groupId, String languageId);
154    
155            public boolean isAvailableLocale(String languageId);
156    
157            public boolean isBetaLocale(Locale locale);
158    
159            public boolean isDuplicateLanguageCode(String languageCode);
160    
161            public boolean isInheritLocales(long groupId) throws PortalException;
162    
163            public String process(
164                    ResourceBundle resourceBundle, Locale locale, String content);
165    
166            public void resetAvailableGroupLocales(long groupId);
167    
168            public void resetAvailableLocales(long companyId);
169    
170            public void updateCookie(
171                    HttpServletRequest request, HttpServletResponse response,
172                    Locale locale);
173    
174    }