1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.kernel.language;
24  
25  import java.util.Locale;
26  
27  import javax.portlet.PortletRequest;
28  
29  import javax.servlet.http.HttpServletRequest;
30  import javax.servlet.http.HttpServletResponse;
31  import javax.servlet.jsp.PageContext;
32  
33  /**
34   * <a href="Language.java.html"><b><i>View Source</i></b></a>
35   *
36   * @author Brian Wing Shun Chan
37   *
38   */
39  public interface Language {
40  
41      public String format(Locale locale, String pattern, Object argument);
42  
43      public String format(
44          Locale locale, String pattern, Object argument,
45          boolean translateArguments);
46  
47      public String format(Locale locale, String pattern, Object[] arguments);
48  
49      public String format(
50          long companyId, Locale locale, String pattern, Object argument);
51  
52      public String format(
53          long companyId, Locale locale, String pattern, Object argument,
54          boolean translateArguments);
55  
56      public String format(
57          long companyId, Locale locale, String pattern, Object[] arguments);
58  
59      public String format(
60          long companyId, Locale locale, String pattern, Object[] arguments,
61          boolean translateArguments);
62  
63      public String format(
64          PageContext pageContext, String pattern, Object argument);
65  
66      public String format(
67          PageContext pageContext, String pattern, Object argument,
68          boolean translateArguments);
69  
70      public String format(
71          PageContext pageContext, String pattern, Object[] arguments);
72  
73      public String format(
74          PageContext pageContext, String pattern, Object[] arguments,
75          boolean translateArguments);
76  
77      public String format(
78          PageContext pageContext, String pattern, LanguageWrapper argument);
79  
80      public String format(
81          PageContext pageContext, String pattern, LanguageWrapper argument,
82          boolean translateArguments);
83  
84      public String format(
85          PageContext pageContext, String pattern, LanguageWrapper[] arguments);
86  
87      public String format(
88          PageContext pageContext, String pattern, LanguageWrapper[] arguments,
89          boolean translateArguments);
90  
91      public void init();
92  
93      public String get(Locale locale, String key);
94  
95      public String get(long companyId, Locale locale, String key);
96  
97      public String get(
98          long companyId, Locale locale, String key, String defaultValue);
99  
100     public String get(PageContext pageContext, String key);
101 
102     public String get(PageContext pageContext, String key, String defaultValue);
103 
104     public Locale[] getAvailableLocales();
105 
106     public String getCharset(Locale locale);
107 
108     public String getLanguageId(PortletRequest portletRequest);
109 
110     public String getLanguageId(HttpServletRequest request);
111 
112     public String getLanguageId(Locale locale);
113 
114     public Locale getLocale(String languageCode);
115 
116     public String getTimeDescription(
117         PageContext pageContext, Long milliseconds);
118 
119     public String getTimeDescription(
120         PageContext pageContext, long milliseconds);
121 
122     public boolean isAvailableLocale(Locale locale);
123 
124     public void resetAvailableLocales(long companyId);
125 
126     public void updateCookie(
127         HttpServletRequest request, HttpServletResponse response,
128         Locale locale);
129 
130 }