1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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(Locale locale, String pattern, Object[] arguments);
44  
45      public String format(
46          long companyId, Locale locale, String pattern, Object argument);
47  
48      public String format(
49          long companyId, Locale locale, String pattern, Object[] arguments);
50  
51      public String format(
52          PageContext pageContext, String pattern, Object argument);
53  
54      public String format(
55          PageContext pageContext, String pattern, Object argument,
56          boolean translateArguments);
57  
58      public String format(
59          PageContext pageContext, String pattern, Object[] arguments);
60  
61      public String format(
62          PageContext pageContext, String pattern, Object[] arguments,
63          boolean translateArguments);
64  
65      public String format(
66          PageContext pageContext, String pattern, LanguageWrapper argument);
67  
68      public String format(
69          PageContext pageContext, String pattern, LanguageWrapper argument,
70          boolean translateArguments);
71  
72      public String format(
73          PageContext pageContext, String pattern, LanguageWrapper[] arguments);
74  
75      public String format(
76          PageContext pageContext, String pattern, LanguageWrapper[] arguments,
77          boolean translateArguments);
78  
79      public void init();
80  
81      public String get(Locale locale, String key);
82  
83      public String get(long companyId, Locale locale, String key);
84  
85      public String get(
86          long companyId, Locale locale, String key, String defaultValue);
87  
88      public String get(PageContext pageContext, String key);
89  
90      public String get(PageContext pageContext, String key, String defaultValue);
91  
92      public Locale[] getAvailableLocales();
93  
94      public String getCharset(Locale locale);
95  
96      public String getLanguageId(PortletRequest portletRequest);
97  
98      public String getLanguageId(HttpServletRequest request);
99  
100     public String getLanguageId(Locale locale);
101 
102     public Locale getLocale(String languageCode);
103 
104     public String getTimeDescription(
105         PageContext pageContext, Long milliseconds);
106 
107     public String getTimeDescription(
108         PageContext pageContext, long milliseconds);
109 
110     public void updateCookie(HttpServletResponse response, Locale locale);
111 
112 }