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          PageContext pageContext, String pattern, Object argument) {
53  
54          return UnicodeFormatter.toString(LanguageUtil.format(
55              pageContext, pattern, argument));
56      }
57  
58      public String format(
59          PageContext pageContext, String pattern, Object argument,
60          boolean translateArguments) {
61  
62          return UnicodeFormatter.toString(LanguageUtil.format(
63              pageContext, pattern, argument, translateArguments));
64      }
65  
66      public String format(
67          PageContext pageContext, String pattern, Object[] arguments) {
68  
69          return UnicodeFormatter.toString(LanguageUtil.format(
70              pageContext, pattern, arguments));
71      }
72  
73      public String format(
74          PageContext pageContext, String pattern, Object[] arguments,
75          boolean translateArguments) {
76  
77          return UnicodeFormatter.toString(LanguageUtil.format(
78              pageContext, pattern, arguments, translateArguments));
79      }
80  
81      public String format(
82          PageContext pageContext, String pattern, LanguageWrapper argument) {
83  
84          return UnicodeFormatter.toString(LanguageUtil.format(
85              pageContext, pattern, argument));
86      }
87  
88      public String format(
89          PageContext pageContext, String pattern, LanguageWrapper argument,
90          boolean translateArguments) {
91  
92          return UnicodeFormatter.toString(LanguageUtil.format(
93              pageContext, pattern, argument, translateArguments));
94      }
95  
96      public String format(
97          PageContext pageContext, String pattern, LanguageWrapper[] arguments) {
98  
99          return UnicodeFormatter.toString(LanguageUtil.format(
100             pageContext, pattern, arguments));
101     }
102 
103     public String format(
104         PageContext pageContext, String pattern, LanguageWrapper[] arguments,
105         boolean translateArguments) {
106 
107         return UnicodeFormatter.toString(LanguageUtil.format(
108             pageContext, pattern, arguments, translateArguments));
109     }
110 
111     public String get(Locale locale, String key) {
112         return UnicodeFormatter.toString(LanguageUtil.get(locale, key));
113     }
114 
115     public String get(Locale locale, String key, String defaultValue) {
116         return UnicodeFormatter.toString(LanguageUtil.get(
117             locale, key, defaultValue));
118     }
119 
120     public String get(PageContext pageContext, String key) {
121         return UnicodeFormatter.toString(LanguageUtil.get(pageContext, key));
122     }
123 
124     public String get(
125         PageContext pageContext, String key, String defaultValue) {
126 
127         return UnicodeFormatter.toString(LanguageUtil.get(
128             pageContext, key, defaultValue));
129     }
130 
131     public String getTimeDescription(
132         PageContext pageContext, Long milliseconds) {
133 
134         return UnicodeFormatter.toString(LanguageUtil.getTimeDescription(
135             pageContext, milliseconds));
136     }
137 
138     public String getTimeDescription(
139         PageContext pageContext, long milliseconds) {
140 
141         return UnicodeFormatter.toString(LanguageUtil.getTimeDescription(
142             pageContext, milliseconds));
143     }
144 
145 }