1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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  public class UnicodeLanguageImpl implements UnicodeLanguage {
40  
41      public String format(Locale locale, String pattern, Object argument) {
42          return UnicodeFormatter.toString(LanguageUtil.format(
43              locale, pattern, argument));
44      }
45  
46      public String format(Locale locale, String pattern, Object[] arguments) {
47          return UnicodeFormatter.toString(LanguageUtil.format(
48              locale, pattern, arguments));
49      }
50  
51      public String format(
52          long companyId, Locale locale, String pattern, Object argument) {
53  
54          return UnicodeFormatter.toString(LanguageUtil.format(
55              companyId, locale, pattern, argument));
56      }
57  
58      public String format(
59          long companyId, Locale locale, String pattern, Object[] arguments) {
60  
61          return UnicodeFormatter.toString(LanguageUtil.format(
62              companyId, locale, pattern, arguments));
63      }
64  
65      public String format(
66          PageContext pageContext, String pattern, Object argument) {
67  
68          return UnicodeFormatter.toString(LanguageUtil.format(
69              pageContext, pattern, argument));
70      }
71  
72      public String format(
73          PageContext pageContext, String pattern, Object argument,
74          boolean translateArguments) {
75  
76          return UnicodeFormatter.toString(LanguageUtil.format(
77              pageContext, pattern, argument, translateArguments));
78      }
79  
80      public String format(
81          PageContext pageContext, String pattern, Object[] arguments) {
82  
83          return UnicodeFormatter.toString(LanguageUtil.format(
84              pageContext, pattern, arguments));
85      }
86  
87      public String format(
88          PageContext pageContext, String pattern, Object[] arguments,
89          boolean translateArguments) {
90  
91          return UnicodeFormatter.toString(LanguageUtil.format(
92              pageContext, pattern, arguments, translateArguments));
93      }
94  
95      public String format(
96          PageContext pageContext, String pattern, LanguageWrapper argument) {
97  
98          return UnicodeFormatter.toString(LanguageUtil.format(
99              pageContext, pattern, argument));
100     }
101 
102     public String format(
103         PageContext pageContext, String pattern, LanguageWrapper argument,
104         boolean translateArguments) {
105 
106         return UnicodeFormatter.toString(LanguageUtil.format(
107             pageContext, pattern, argument, translateArguments));
108     }
109 
110     public String format(
111         PageContext pageContext, String pattern, LanguageWrapper[] arguments) {
112 
113         return UnicodeFormatter.toString(LanguageUtil.format(
114             pageContext, pattern, arguments));
115     }
116 
117     public String format(
118         PageContext pageContext, String pattern, LanguageWrapper[] arguments,
119         boolean translateArguments) {
120 
121         return UnicodeFormatter.toString(LanguageUtil.format(
122             pageContext, pattern, arguments, translateArguments));
123     }
124 
125     public String get(Locale locale, String key) {
126         return UnicodeFormatter.toString(LanguageUtil.get(locale, key));
127     }
128 
129     public String get(long companyId, Locale locale, String key) {
130         return UnicodeFormatter.toString(
131             LanguageUtil.get(companyId, locale, key));
132     }
133 
134     public String get(
135         long companyId, Locale locale, String key, String defaultValue) {
136 
137         return UnicodeFormatter.toString(
138             LanguageUtil.get(companyId, locale, key, defaultValue));
139     }
140 
141     public String get(PageContext pageContext, String key) {
142         return UnicodeFormatter.toString(LanguageUtil.get(pageContext, key));
143     }
144 
145     public String get(
146         PageContext pageContext, String key, String defaultValue) {
147 
148         return UnicodeFormatter.toString(LanguageUtil.get(
149             pageContext, key, defaultValue));
150     }
151 
152     public String getTimeDescription(
153         PageContext pageContext, Long milliseconds) {
154 
155         return UnicodeFormatter.toString(LanguageUtil.getTimeDescription(
156             pageContext, milliseconds));
157     }
158 
159     public String getTimeDescription(
160         PageContext pageContext, long milliseconds) {
161 
162         return UnicodeFormatter.toString(LanguageUtil.getTimeDescription(
163             pageContext, milliseconds));
164     }
165 
166 }