public class I18n extends Object
Strings, Dates and Numbers. Additionally, a message can be
retrieved by delegating to RequestSupport.getMessage(String, Object...).I18n is being added to each ExpressionEvaluator returned by
Request.getExpressionEvaluator(), you can easily use the methods provided by I18n in your
expressions.ResourceBundle containing the following entries:
dateFormat = yyyy-MM-dd
today = Today: {0}
Reading the format for a FieldDef using message(String, Object...):
<field name="validFrom" type="date" format="${i18n.message('dateFormat')}">
leads to
<field name="validFrom" type="date" format="yyyy-MM-dd">
Label using message(String, Object...) and formatDate(Date, String)
<label>${i18n.message('today', i18n.formatDate(current.date, i18n.message('dateFormat')))}</label>
leads to (assuming current.today returns a Date):
<label>Today: 2013-03-08</label>
| Modifier and Type | Method and Description |
|---|---|
String |
format(String format,
Object... args)
Formats the given
String with the given arguments. |
String |
formatDate(Date date,
String format)
Formats the given
Date using the given format. |
String |
formatNumber(Number number,
String format)
Formats the given
Number using the given format. |
String |
message(String key)
Returns an internationalized message by delegating to
RequestSupport.getMessage(String, Object...). |
String |
message(String key,
Object... args)
Returns an internationalized message by delegating to
RequestSupport.getMessage(String, Object...). |
public String message(String key)
RequestSupport.getMessage(String, Object...). Applies the
Locale provided by Request.getLocale().key - the message keyRequestSupport.getMessage(String, Object...)public String message(String key, Object... args)
RequestSupport.getMessage(String, Object...). Applies the
Locale provided by Request.getLocale().key - the message keyargs - the message argumentsRequestSupport.getMessage(String, Object...)public String format(String format, Object... args)
String with the given arguments. Delegates to
String.format(java.util.Locale, String, Object...) using the Locale provided by
Request.getLocale().format - the String to formatargs - the arguments passed toString.format(Locale, String, Object...)public String formatDate(Date date, String format)
Date using the given format. Internally, a SimpleDateFormat is being
used. Applies the Locale provided by Request.getLocale().date - the Date to formatformat - the the formatNumberSimpleDateFormat(String, Locale),
DateFormat.format(Date)public String formatNumber(Number number, String format)
Number using the given format. Internally, a NumberFormat is being
used, which applies the Locale provided by Request.getLocale().number - the Number to formatformat - the the formatNumberNumberFormat.getNumberInstance(Locale)Copyright © 2011–2022 aiticon GmbH. All rights reserved.