1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.language;
21  
22  import com.liferay.portal.kernel.language.LanguageUtil;
23  import com.liferay.portal.kernel.language.LanguageWrapper;
24  import com.liferay.portal.kernel.language.UnicodeLanguage;
25  import com.liferay.portal.kernel.util.UnicodeFormatter;
26  
27  import java.util.Locale;
28  
29  import javax.servlet.jsp.PageContext;
30  
31  /**
32   * <a href="UnicodeLanguageImpl.java.html"><b><i>View Source</i></b></a>
33   *
34   * @author Brian Wing Shun Chan
35   *
36   */
37  public class UnicodeLanguageImpl implements UnicodeLanguage {
38  
39      public String format(Locale locale, String pattern, Object argument) {
40          return UnicodeFormatter.toString(LanguageUtil.format(
41              locale, pattern, argument));
42      }
43  
44      public String format(Locale locale, String pattern, Object[] arguments) {
45          return UnicodeFormatter.toString(LanguageUtil.format(
46              locale, pattern, arguments));
47      }
48  
49      public String format(
50          long companyId, Locale locale, String pattern, Object argument) {
51  
52          return UnicodeFormatter.toString(LanguageUtil.format(
53              companyId, locale, pattern, argument));
54      }
55  
56      public String format(
57          long companyId, Locale locale, String pattern, Object[] arguments) {
58  
59          return UnicodeFormatter.toString(LanguageUtil.format(
60              companyId, locale, pattern, arguments));
61      }
62  
63      public String format(
64          PageContext pageContext, String pattern, Object argument) {
65  
66          return UnicodeFormatter.toString(LanguageUtil.format(
67              pageContext, pattern, argument));
68      }
69  
70      public String format(
71          PageContext pageContext, String pattern, Object argument,
72          boolean translateArguments) {
73  
74          return UnicodeFormatter.toString(LanguageUtil.format(
75              pageContext, pattern, argument, translateArguments));
76      }
77  
78      public String format(
79          PageContext pageContext, String pattern, Object[] arguments) {
80  
81          return UnicodeFormatter.toString(LanguageUtil.format(
82              pageContext, pattern, arguments));
83      }
84  
85      public String format(
86          PageContext pageContext, String pattern, Object[] arguments,
87          boolean translateArguments) {
88  
89          return UnicodeFormatter.toString(LanguageUtil.format(
90              pageContext, pattern, arguments, translateArguments));
91      }
92  
93      public String format(
94          PageContext pageContext, String pattern, LanguageWrapper argument) {
95  
96          return UnicodeFormatter.toString(LanguageUtil.format(
97              pageContext, pattern, argument));
98      }
99  
100     public String format(
101         PageContext pageContext, String pattern, LanguageWrapper argument,
102         boolean translateArguments) {
103 
104         return UnicodeFormatter.toString(LanguageUtil.format(
105             pageContext, pattern, argument, translateArguments));
106     }
107 
108     public String format(
109         PageContext pageContext, String pattern, LanguageWrapper[] arguments) {
110 
111         return UnicodeFormatter.toString(LanguageUtil.format(
112             pageContext, pattern, arguments));
113     }
114 
115     public String format(
116         PageContext pageContext, String pattern, LanguageWrapper[] arguments,
117         boolean translateArguments) {
118 
119         return UnicodeFormatter.toString(LanguageUtil.format(
120             pageContext, pattern, arguments, translateArguments));
121     }
122 
123     public String get(Locale locale, String key) {
124         return UnicodeFormatter.toString(LanguageUtil.get(locale, key));
125     }
126 
127     public String get(long companyId, Locale locale, String key) {
128         return UnicodeFormatter.toString(
129             LanguageUtil.get(companyId, locale, key));
130     }
131 
132     public String get(
133         long companyId, Locale locale, String key, String defaultValue) {
134 
135         return UnicodeFormatter.toString(
136             LanguageUtil.get(companyId, locale, key, defaultValue));
137     }
138 
139     public String get(PageContext pageContext, String key) {
140         return UnicodeFormatter.toString(LanguageUtil.get(pageContext, key));
141     }
142 
143     public String get(
144         PageContext pageContext, String key, String defaultValue) {
145 
146         return UnicodeFormatter.toString(LanguageUtil.get(
147             pageContext, key, defaultValue));
148     }
149 
150     public String getTimeDescription(
151         PageContext pageContext, Long milliseconds) {
152 
153         return UnicodeFormatter.toString(LanguageUtil.getTimeDescription(
154             pageContext, milliseconds));
155     }
156 
157     public String getTimeDescription(
158         PageContext pageContext, long milliseconds) {
159 
160         return UnicodeFormatter.toString(LanguageUtil.getTimeDescription(
161             pageContext, milliseconds));
162     }
163 
164 }