1   /**
2    * Copyright (c) 2000-2009 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.language;
24  
25  import com.liferay.portal.kernel.language.LanguageUtil;
26  import com.liferay.portal.kernel.language.LanguageWrapper;
27  import com.liferay.portal.kernel.language.UnicodeLanguage;
28  import com.liferay.portal.kernel.util.UnicodeFormatter;
29  
30  import java.util.Locale;
31  
32  import javax.servlet.jsp.PageContext;
33  
34  /**
35   * <a href="UnicodeLanguageImpl.java.html"><b><i>View Source</i></b></a>
36   *
37   * @author Brian Wing Shun Chan
38   *
39   */
40  public class UnicodeLanguageImpl implements UnicodeLanguage {
41  
42      public String format(Locale locale, String pattern, Object argument) {
43          return UnicodeFormatter.toString(LanguageUtil.format(
44              locale, pattern, argument));
45      }
46  
47      public String format(Locale locale, String pattern, Object[] arguments) {
48          return UnicodeFormatter.toString(LanguageUtil.format(
49              locale, pattern, arguments));
50      }
51  
52      public String format(
53          long companyId, Locale locale, String pattern, Object argument) {
54  
55          return UnicodeFormatter.toString(LanguageUtil.format(
56              companyId, locale, pattern, argument));
57      }
58  
59      public String format(
60          long companyId, Locale locale, String pattern, Object[] arguments) {
61  
62          return UnicodeFormatter.toString(LanguageUtil.format(
63              companyId, locale, pattern, arguments));
64      }
65  
66      public String format(
67          PageContext pageContext, String pattern, Object argument) {
68  
69          return UnicodeFormatter.toString(LanguageUtil.format(
70              pageContext, pattern, argument));
71      }
72  
73      public String format(
74          PageContext pageContext, String pattern, Object argument,
75          boolean translateArguments) {
76  
77          return UnicodeFormatter.toString(LanguageUtil.format(
78              pageContext, pattern, argument, translateArguments));
79      }
80  
81      public String format(
82          PageContext pageContext, String pattern, Object[] arguments) {
83  
84          return UnicodeFormatter.toString(LanguageUtil.format(
85              pageContext, pattern, arguments));
86      }
87  
88      public String format(
89          PageContext pageContext, String pattern, Object[] arguments,
90          boolean translateArguments) {
91  
92          return UnicodeFormatter.toString(LanguageUtil.format(
93              pageContext, pattern, arguments, translateArguments));
94      }
95  
96      public String format(
97          PageContext pageContext, String pattern, LanguageWrapper argument) {
98  
99          return UnicodeFormatter.toString(LanguageUtil.format(
100             pageContext, pattern, argument));
101     }
102 
103     public String format(
104         PageContext pageContext, String pattern, LanguageWrapper argument,
105         boolean translateArguments) {
106 
107         return UnicodeFormatter.toString(LanguageUtil.format(
108             pageContext, pattern, argument, translateArguments));
109     }
110 
111     public String format(
112         PageContext pageContext, String pattern, LanguageWrapper[] arguments) {
113 
114         return UnicodeFormatter.toString(LanguageUtil.format(
115             pageContext, pattern, arguments));
116     }
117 
118     public String format(
119         PageContext pageContext, String pattern, LanguageWrapper[] arguments,
120         boolean translateArguments) {
121 
122         return UnicodeFormatter.toString(LanguageUtil.format(
123             pageContext, pattern, arguments, translateArguments));
124     }
125 
126     public String get(Locale locale, String key) {
127         return UnicodeFormatter.toString(LanguageUtil.get(locale, key));
128     }
129 
130     public String get(long companyId, Locale locale, String key) {
131         return UnicodeFormatter.toString(
132             LanguageUtil.get(companyId, locale, key));
133     }
134 
135     public String get(
136         long companyId, Locale locale, String key, String defaultValue) {
137 
138         return UnicodeFormatter.toString(
139             LanguageUtil.get(companyId, locale, key, defaultValue));
140     }
141 
142     public String get(PageContext pageContext, String key) {
143         return UnicodeFormatter.toString(LanguageUtil.get(pageContext, key));
144     }
145 
146     public String get(
147         PageContext pageContext, String key, String defaultValue) {
148 
149         return UnicodeFormatter.toString(LanguageUtil.get(
150             pageContext, key, defaultValue));
151     }
152 
153     public String getTimeDescription(
154         PageContext pageContext, Long milliseconds) {
155 
156         return UnicodeFormatter.toString(LanguageUtil.getTimeDescription(
157             pageContext, milliseconds));
158     }
159 
160     public String getTimeDescription(
161         PageContext pageContext, long milliseconds) {
162 
163         return UnicodeFormatter.toString(LanguageUtil.getTimeDescription(
164             pageContext, milliseconds));
165     }
166 
167 }