001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.language;
016    
017    import com.liferay.portal.kernel.language.LanguageUtil;
018    import com.liferay.portal.kernel.language.LanguageWrapper;
019    import com.liferay.portal.kernel.language.UnicodeLanguage;
020    import com.liferay.portal.kernel.util.UnicodeFormatter;
021    
022    import java.util.Locale;
023    
024    import javax.portlet.PortletConfig;
025    
026    import javax.servlet.jsp.PageContext;
027    
028    /**
029     * @author Brian Wing Shun Chan
030     */
031    public class UnicodeLanguageImpl implements UnicodeLanguage {
032    
033            public String format(Locale locale, String pattern, Object argument) {
034                    return UnicodeFormatter.toString(
035                            LanguageUtil.format(locale, pattern, argument));
036            }
037    
038            public String format(
039                    Locale locale, String pattern, Object argument,
040                    boolean translateArguments) {
041    
042                    return UnicodeFormatter.toString(
043                            LanguageUtil.format(locale, pattern, argument, translateArguments));
044            }
045    
046            public String format(Locale locale, String pattern, Object[] arguments) {
047                    return UnicodeFormatter.toString(
048                            LanguageUtil.format(locale, pattern, arguments));
049            }
050    
051            public String format(
052                    Locale locale, String pattern, Object[] arguments,
053                    boolean translateArguments) {
054    
055                    return UnicodeFormatter.toString(
056                            LanguageUtil.format(
057                                    locale, pattern, arguments, translateArguments));
058            }
059    
060            public String format(
061                    PageContext pageContext, String pattern, LanguageWrapper argument) {
062    
063                    return UnicodeFormatter.toString(
064                            LanguageUtil.format(pageContext, pattern, argument));
065            }
066    
067            public String format(
068                    PageContext pageContext, String pattern, LanguageWrapper argument,
069                    boolean translateArguments) {
070    
071                    return UnicodeFormatter.toString(
072                            LanguageUtil.format(
073                                    pageContext, pattern, argument, translateArguments));
074            }
075    
076            public String format(
077                    PageContext pageContext, String pattern, LanguageWrapper[] arguments) {
078    
079                    return UnicodeFormatter.toString(
080                            LanguageUtil.format(pageContext, pattern, arguments));
081            }
082    
083            public String format(
084                    PageContext pageContext, String pattern, LanguageWrapper[] arguments,
085                    boolean translateArguments) {
086    
087                    return UnicodeFormatter.toString(
088                            LanguageUtil.format(
089                                    pageContext, pattern, arguments, translateArguments));
090            }
091    
092            public String format(
093                    PageContext pageContext, String pattern, Object argument) {
094    
095                    return UnicodeFormatter.toString(
096                            LanguageUtil.format(pageContext, pattern, argument));
097            }
098    
099            public String format(
100                    PageContext pageContext, String pattern, Object argument,
101                    boolean translateArguments) {
102    
103                    return UnicodeFormatter.toString(
104                            LanguageUtil.format(
105                                    pageContext, pattern, argument, translateArguments));
106            }
107    
108            public String format(
109                    PageContext pageContext, String pattern, Object[] arguments) {
110    
111                    return UnicodeFormatter.toString(
112                            LanguageUtil.format(pageContext, pattern, arguments));
113            }
114    
115            public String format(
116                    PageContext pageContext, String pattern, Object[] arguments,
117                    boolean translateArguments) {
118    
119                    return UnicodeFormatter.toString(
120                            LanguageUtil.format(
121                                    pageContext, pattern, arguments, translateArguments));
122            }
123    
124            public String format(
125                    PortletConfig portletConfig, Locale locale, String pattern,
126                    Object argument) {
127    
128                    return UnicodeFormatter.toString(
129                            LanguageUtil.format(portletConfig, locale, pattern, argument));
130            }
131    
132            public String format(
133                    PortletConfig portletConfig, Locale locale, String pattern,
134                    Object argument, boolean translateArguments) {
135    
136                    return UnicodeFormatter.toString(
137                            LanguageUtil.format(
138                                    portletConfig, locale, pattern, argument, translateArguments));
139            }
140    
141            public String format(
142                    PortletConfig portletConfig, Locale locale, String pattern,
143                    Object[] arguments) {
144    
145                    return UnicodeFormatter.toString(
146                            LanguageUtil.format(portletConfig, locale, pattern, arguments));
147            }
148    
149            public String format(
150                    PortletConfig portletConfig, Locale locale, String pattern,
151                    Object[] arguments, boolean translateArguments) {
152    
153                    return UnicodeFormatter.toString(
154                            LanguageUtil.format(
155                                    portletConfig, locale, pattern, arguments, translateArguments));
156            }
157    
158            public String get(Locale locale, String key) {
159                    return UnicodeFormatter.toString(LanguageUtil.get(locale, key));
160            }
161    
162            public String get(Locale locale, String key, String defaultValue) {
163                    return UnicodeFormatter.toString(
164                            LanguageUtil.get(locale, key, defaultValue));
165            }
166    
167            public String get(PageContext pageContext, String key) {
168                    return UnicodeFormatter.toString(LanguageUtil.get(pageContext, key));
169            }
170    
171            public String get(
172                    PageContext pageContext, String key, String defaultValue) {
173    
174                    return UnicodeFormatter.toString(
175                            LanguageUtil.get(pageContext, key, defaultValue));
176            }
177    
178            public String get(PortletConfig portletConfig, Locale locale, String key) {
179                    return UnicodeFormatter.toString(
180                            LanguageUtil.get(portletConfig, locale, key));
181            }
182    
183            public String get(
184                    PortletConfig portletConfig, Locale locale, String key,
185                    String defaultValue) {
186    
187                    return UnicodeFormatter.toString(
188                            LanguageUtil.get(portletConfig, locale, key, defaultValue));
189            }
190    
191            public String getTimeDescription(
192                    PageContext pageContext, long milliseconds) {
193    
194                    return UnicodeFormatter.toString(
195                            LanguageUtil.getTimeDescription(pageContext, milliseconds));
196            }
197    
198            public String getTimeDescription(
199                    PageContext pageContext, Long milliseconds) {
200    
201                    return UnicodeFormatter.toString(
202                            LanguageUtil.getTimeDescription(pageContext, milliseconds));
203            }
204    
205    }