1   /**
2    * Copyright (c) 2000-2007 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.ActionRequest;
28  import javax.portlet.RenderRequest;
29  
30  import javax.servlet.http.HttpServletRequest;
31  import javax.servlet.http.HttpServletResponse;
32  import javax.servlet.jsp.PageContext;
33  
34  /**
35   * <a href="Language.java.html"><b><i>View Source</i></b></a>
36   *
37   * @author Brian Wing Shun Chan
38   *
39   */
40  public interface Language {
41  
42      public String format(Locale locale, String pattern, Object argument);
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[] arguments);
51  
52      public String format(
53          PageContext pageContext, String pattern, Object argument);
54  
55      public String format(
56          PageContext pageContext, String pattern, Object argument,
57          boolean translateArguments);
58  
59      public String format(
60          PageContext pageContext, String pattern, Object[] arguments);
61  
62      public String format(
63          PageContext pageContext, String pattern, Object[] arguments,
64          boolean translateArguments);
65  
66      public String format(
67          PageContext pageContext, String pattern, LanguageWrapper argument);
68  
69      public String format(
70          PageContext pageContext, String pattern, LanguageWrapper argument,
71          boolean translateArguments);
72  
73      public String format(
74          PageContext pageContext, String pattern, LanguageWrapper[] arguments);
75  
76      public String format(
77          PageContext pageContext, String pattern, LanguageWrapper[] arguments,
78          boolean translateArguments);
79  
80      public String get(Locale locale, String key);
81  
82      public String get(long companyId, Locale locale, String key);
83  
84      public String get(
85          long companyId, Locale locale, String key, String defaultValue);
86  
87      public String get(PageContext pageContext, String key);
88  
89      public String get(PageContext pageContext, String key, String defaultValue);
90  
91      public Locale[] getAvailableLocales();
92  
93      public String getCharset(Locale locale);
94  
95      public String getLanguageId(ActionRequest req);
96  
97      public String getLanguageId(RenderRequest req);
98  
99      public String getLanguageId(HttpServletRequest req);
100 
101     public String getLanguageId(Locale locale);
102 
103     public Locale getLocale(String languageCode);
104 
105     public String getTimeDescription(
106         PageContext pageContext, Long milliseconds);
107 
108     public String getTimeDescription(
109         PageContext pageContext, long milliseconds);
110 
111     public void updateCookie(HttpServletResponse res, Locale locale);
112 
113 }