1   /**
2    * Copyright (c) 2000-2010 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   *
12   *
13   */
14  
15  package com.liferay.portal.language;
16  
17  import com.liferay.portal.kernel.language.LanguageUtil;
18  import com.liferay.portal.kernel.language.LanguageWrapper;
19  import com.liferay.portal.kernel.language.UnicodeLanguage;
20  import com.liferay.portal.kernel.util.UnicodeFormatter;
21  
22  import java.util.Locale;
23  
24  import javax.portlet.PortletConfig;
25  
26  import javax.servlet.jsp.PageContext;
27  
28  /**
29   * <a href="UnicodeLanguageImpl.java.html"><b><i>View Source</i></b></a>
30   *
31   * @author Brian Wing Shun Chan
32   */
33  public class UnicodeLanguageImpl implements UnicodeLanguage {
34  
35      public String format(Locale locale, String pattern, Object argument) {
36          return UnicodeFormatter.toString(
37              LanguageUtil.format(locale, pattern, argument));
38      }
39  
40      public String format(
41          Locale locale, String pattern, Object argument,
42          boolean translateArguments) {
43  
44          return UnicodeFormatter.toString(
45              LanguageUtil.format(locale, pattern, argument, translateArguments));
46      }
47  
48      public String format(Locale locale, String pattern, Object[] arguments) {
49          return UnicodeFormatter.toString(
50              LanguageUtil.format(locale, pattern, arguments));
51      }
52  
53      public String format(
54          Locale locale, String pattern, Object[] arguments,
55          boolean translateArguments) {
56  
57          return UnicodeFormatter.toString(
58              LanguageUtil.format(
59                  locale, pattern, arguments, translateArguments));
60      }
61  
62      public String format(
63          PageContext pageContext, String pattern, LanguageWrapper argument) {
64  
65          return UnicodeFormatter.toString(
66              LanguageUtil.format(pageContext, pattern, argument));
67      }
68  
69      public String format(
70          PageContext pageContext, String pattern, LanguageWrapper argument,
71          boolean translateArguments) {
72  
73          return UnicodeFormatter.toString(
74              LanguageUtil.format(
75                  pageContext, pattern, argument, translateArguments));
76      }
77  
78      public String format(
79          PageContext pageContext, String pattern, LanguageWrapper[] arguments) {
80  
81          return UnicodeFormatter.toString(
82              LanguageUtil.format(pageContext, pattern, arguments));
83      }
84  
85      public String format(
86          PageContext pageContext, String pattern, LanguageWrapper[] arguments,
87          boolean translateArguments) {
88  
89          return UnicodeFormatter.toString(
90              LanguageUtil.format(
91                  pageContext, pattern, arguments, translateArguments));
92      }
93  
94      public String format(
95          PageContext pageContext, String pattern, Object argument) {
96  
97          return UnicodeFormatter.toString(
98              LanguageUtil.format(pageContext, pattern, argument));
99      }
100 
101     public String format(
102         PageContext pageContext, String pattern, Object argument,
103         boolean translateArguments) {
104 
105         return UnicodeFormatter.toString(
106             LanguageUtil.format(
107                 pageContext, pattern, argument, translateArguments));
108     }
109 
110     public String format(
111         PageContext pageContext, String pattern, Object[] arguments) {
112 
113         return UnicodeFormatter.toString(
114             LanguageUtil.format(pageContext, pattern, arguments));
115     }
116 
117     public String format(
118         PageContext pageContext, String pattern, Object[] arguments,
119         boolean translateArguments) {
120 
121         return UnicodeFormatter.toString(
122             LanguageUtil.format(
123                 pageContext, pattern, arguments, translateArguments));
124     }
125 
126     public String format(
127         PortletConfig portletConfig, Locale locale, String pattern,
128         Object argument) {
129 
130         return UnicodeFormatter.toString(
131             LanguageUtil.format(portletConfig, locale, pattern, argument));
132     }
133 
134     public String format(
135         PortletConfig portletConfig, Locale locale, String pattern,
136         Object argument, boolean translateArguments) {
137 
138         return UnicodeFormatter.toString(
139             LanguageUtil.format(
140                 portletConfig, locale, pattern, argument, translateArguments));
141     }
142 
143     public String format(
144         PortletConfig portletConfig, Locale locale, String pattern,
145         Object[] arguments) {
146 
147         return UnicodeFormatter.toString(
148             LanguageUtil.format(portletConfig, locale, pattern, arguments));
149     }
150 
151     public String format(
152         PortletConfig portletConfig, Locale locale, String pattern,
153         Object[] arguments, boolean translateArguments) {
154 
155         return UnicodeFormatter.toString(
156             LanguageUtil.format(
157                 portletConfig, locale, pattern, arguments, translateArguments));
158     }
159 
160     public String get(Locale locale, String key) {
161         return UnicodeFormatter.toString(LanguageUtil.get(locale, key));
162     }
163 
164     public String get(Locale locale, String key, String defaultValue) {
165         return UnicodeFormatter.toString(
166             LanguageUtil.get(locale, key, defaultValue));
167     }
168 
169     public String get(PageContext pageContext, String key) {
170         return UnicodeFormatter.toString(LanguageUtil.get(pageContext, key));
171     }
172 
173     public String get(
174         PageContext pageContext, String key, String defaultValue) {
175 
176         return UnicodeFormatter.toString(
177             LanguageUtil.get(pageContext, key, defaultValue));
178     }
179 
180     public String get(PortletConfig portletConfig, Locale locale, String key) {
181         return UnicodeFormatter.toString(
182             LanguageUtil.get(portletConfig, locale, key));
183     }
184 
185     public String get(
186         PortletConfig portletConfig, Locale locale, String key,
187         String defaultValue) {
188 
189         return UnicodeFormatter.toString(
190             LanguageUtil.get(portletConfig, locale, key, defaultValue));
191     }
192 
193     public String getTimeDescription(
194         PageContext pageContext, long milliseconds) {
195 
196         return UnicodeFormatter.toString(
197             LanguageUtil.getTimeDescription(pageContext, milliseconds));
198     }
199 
200     public String getTimeDescription(
201         PageContext pageContext, Long milliseconds) {
202 
203         return UnicodeFormatter.toString(
204             LanguageUtil.getTimeDescription(pageContext, milliseconds));
205     }
206 
207 }