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.language;
022:
023: import com.liferay.portal.kernel.language.LanguageUtil;
024: import com.liferay.portal.kernel.language.LanguageWrapper;
025: import com.liferay.portal.kernel.language.UnicodeLanguage;
026: import com.liferay.portal.kernel.util.UnicodeFormatter;
027:
028: import java.util.Locale;
029:
030: import javax.servlet.jsp.PageContext;
031:
032: /**
033: * <a href="UnicodeLanguageImpl.java.html"><b><i>View Source</i></b></a>
034: *
035: * @author Brian Wing Shun Chan
036: *
037: */
038: public class UnicodeLanguageImpl implements UnicodeLanguage {
039:
040: public String format(Locale locale, String pattern, Object argument) {
041: return UnicodeFormatter.toString(LanguageUtil.format(locale,
042: pattern, argument));
043: }
044:
045: public String format(Locale locale, String pattern,
046: Object[] arguments) {
047: return UnicodeFormatter.toString(LanguageUtil.format(locale,
048: pattern, arguments));
049: }
050:
051: public String format(long companyId, Locale locale, String pattern,
052: Object argument) {
053:
054: return UnicodeFormatter.toString(LanguageUtil.format(companyId,
055: locale, pattern, argument));
056: }
057:
058: public String format(long companyId, Locale locale, String pattern,
059: Object[] arguments) {
060:
061: return UnicodeFormatter.toString(LanguageUtil.format(companyId,
062: locale, pattern, arguments));
063: }
064:
065: public String format(PageContext pageContext, String pattern,
066: Object argument) {
067:
068: return UnicodeFormatter.toString(LanguageUtil.format(
069: pageContext, pattern, argument));
070: }
071:
072: public String format(PageContext pageContext, String pattern,
073: Object argument, boolean translateArguments) {
074:
075: return UnicodeFormatter.toString(LanguageUtil.format(
076: pageContext, pattern, argument, translateArguments));
077: }
078:
079: public String format(PageContext pageContext, String pattern,
080: Object[] arguments) {
081:
082: return UnicodeFormatter.toString(LanguageUtil.format(
083: pageContext, pattern, arguments));
084: }
085:
086: public String format(PageContext pageContext, String pattern,
087: Object[] arguments, boolean translateArguments) {
088:
089: return UnicodeFormatter.toString(LanguageUtil.format(
090: pageContext, pattern, arguments, translateArguments));
091: }
092:
093: public String format(PageContext pageContext, String pattern,
094: LanguageWrapper argument) {
095:
096: return UnicodeFormatter.toString(LanguageUtil.format(
097: pageContext, pattern, argument));
098: }
099:
100: public String format(PageContext pageContext, String pattern,
101: LanguageWrapper argument, boolean translateArguments) {
102:
103: return UnicodeFormatter.toString(LanguageUtil.format(
104: pageContext, pattern, argument, translateArguments));
105: }
106:
107: public String format(PageContext pageContext, String pattern,
108: LanguageWrapper[] arguments) {
109:
110: return UnicodeFormatter.toString(LanguageUtil.format(
111: pageContext, pattern, arguments));
112: }
113:
114: public String format(PageContext pageContext, String pattern,
115: LanguageWrapper[] arguments, boolean translateArguments) {
116:
117: return UnicodeFormatter.toString(LanguageUtil.format(
118: pageContext, pattern, arguments, translateArguments));
119: }
120:
121: public String get(Locale locale, String key) {
122: return UnicodeFormatter.toString(LanguageUtil.get(locale, key));
123: }
124:
125: public String get(long companyId, Locale locale, String key) {
126: return UnicodeFormatter.toString(LanguageUtil.get(companyId,
127: locale, key));
128: }
129:
130: public String get(long companyId, Locale locale, String key,
131: String defaultValue) {
132:
133: return UnicodeFormatter.toString(LanguageUtil.get(companyId,
134: locale, key, defaultValue));
135: }
136:
137: public String get(PageContext pageContext, String key) {
138: return UnicodeFormatter.toString(LanguageUtil.get(pageContext,
139: key));
140: }
141:
142: public String get(PageContext pageContext, String key,
143: String defaultValue) {
144:
145: return UnicodeFormatter.toString(LanguageUtil.get(pageContext,
146: key, defaultValue));
147: }
148:
149: public String getTimeDescription(PageContext pageContext,
150: Long milliseconds) {
151:
152: return UnicodeFormatter.toString(LanguageUtil
153: .getTimeDescription(pageContext, milliseconds));
154: }
155:
156: public String getTimeDescription(PageContext pageContext,
157: long milliseconds) {
158:
159: return UnicodeFormatter.toString(LanguageUtil
160: .getTimeDescription(pageContext, milliseconds));
161: }
162:
163: }
|