001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.kernel.language;
022:
023: import com.liferay.portal.kernel.bean.BeanLocatorUtil;
024:
025: import java.util.Locale;
026:
027: import javax.servlet.jsp.PageContext;
028:
029: /**
030: * <a href="UnicodeLanguageUtil.java.html"><b><i>View Source</i></b></a>
031: *
032: * @author Brian Wing Shun Chan
033: *
034: */
035: public class UnicodeLanguageUtil {
036:
037: public static String format(Locale locale, String pattern,
038: Object argument) {
039:
040: return getUnicodeLanguage().format(locale, pattern, argument);
041: }
042:
043: public static String format(Locale locale, String pattern,
044: Object[] arguments) {
045:
046: return getUnicodeLanguage().format(locale, pattern, arguments);
047: }
048:
049: public static String format(long companyId, Locale locale,
050: String pattern, Object argument) {
051:
052: return getUnicodeLanguage().format(companyId, locale, pattern,
053: argument);
054: }
055:
056: public static String format(long companyId, Locale locale,
057: String pattern, Object[] arguments) {
058:
059: return getUnicodeLanguage().format(companyId, locale, pattern,
060: arguments);
061: }
062:
063: public static String format(PageContext pageContext,
064: String pattern, Object argument) {
065:
066: return getUnicodeLanguage().format(pageContext, pattern,
067: argument);
068: }
069:
070: public static String format(PageContext pageContext,
071: String pattern, Object argument, boolean translateArguments) {
072:
073: return getUnicodeLanguage().format(pageContext, pattern,
074: argument, translateArguments);
075: }
076:
077: public static String format(PageContext pageContext,
078: String pattern, Object[] arguments) {
079:
080: return getUnicodeLanguage().format(pageContext, pattern,
081: arguments);
082: }
083:
084: public static String format(PageContext pageContext,
085: String pattern, Object[] arguments,
086: boolean translateArguments) {
087:
088: return getUnicodeLanguage().format(pageContext, pattern,
089: arguments, translateArguments);
090: }
091:
092: public static String format(PageContext pageContext,
093: String pattern, LanguageWrapper argument) {
094:
095: return getUnicodeLanguage().format(pageContext, pattern,
096: argument);
097: }
098:
099: public static String format(PageContext pageContext,
100: String pattern, LanguageWrapper argument,
101: boolean translateArguments) {
102:
103: return getUnicodeLanguage().format(pageContext, pattern,
104: argument, translateArguments);
105: }
106:
107: public static String format(PageContext pageContext,
108: String pattern, LanguageWrapper[] arguments) {
109:
110: return getUnicodeLanguage().format(pageContext, pattern,
111: arguments);
112: }
113:
114: public static String format(PageContext pageContext,
115: String pattern, LanguageWrapper[] arguments,
116: boolean translateArguments) {
117:
118: return getUnicodeLanguage().format(pageContext, pattern,
119: arguments, translateArguments);
120: }
121:
122: public static String get(Locale locale, String key) {
123: return getUnicodeLanguage().get(locale, key);
124: }
125:
126: public static String get(long companyId, Locale locale, String key) {
127: return getUnicodeLanguage().get(companyId, locale, key);
128: }
129:
130: public static String get(long companyId, Locale locale, String key,
131: String defaultValue) {
132:
133: return getUnicodeLanguage().get(companyId, locale, key,
134: defaultValue);
135: }
136:
137: public static String get(PageContext pageContext, String key) {
138: return getUnicodeLanguage().get(pageContext, key);
139: }
140:
141: public static String get(PageContext pageContext, String key,
142: String defaultValue) {
143:
144: return getUnicodeLanguage().get(pageContext, key, defaultValue);
145: }
146:
147: public static String getTimeDescription(PageContext pageContext,
148: Long milliseconds) {
149:
150: return getUnicodeLanguage().getTimeDescription(pageContext,
151: milliseconds);
152: }
153:
154: public static String getTimeDescription(PageContext pageContext,
155: long milliseconds) {
156:
157: return getUnicodeLanguage().getTimeDescription(pageContext,
158: milliseconds);
159: }
160:
161: public static UnicodeLanguage getUnicodeLanguage() {
162: return _getUtil()._unicodeLanguage;
163: }
164:
165: public void setUnicodeLanguage(UnicodeLanguage unicodeLanguage) {
166: _unicodeLanguage = unicodeLanguage;
167: }
168:
169: private static UnicodeLanguageUtil _getUtil() {
170: if (_util == null) {
171: _util = (UnicodeLanguageUtil) BeanLocatorUtil.locate(_UTIL);
172: }
173:
174: return _util;
175: }
176:
177: private static final String _UTIL = UnicodeLanguageUtil.class
178: .getName();
179:
180: private static UnicodeLanguageUtil _util;
181:
182: private UnicodeLanguage _unicodeLanguage;
183:
184: }
|