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