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