public final class I18nService extends Object
Modifier and Type | Method and Description |
---|---|
static List<Locale> |
getAdminAvailableLocales()
Returns supported locales for Lutece backoffice
|
static ReferenceList |
getAdminLocales(Locale locale)
Returns a ReferenceList of available locales
|
static String |
getDateFormatShortPattern(Locale locale)
Get the short date format specified by a locale
|
static Locale |
getDefaultLocale()
Get the default Locale specified in properties file
|
static String |
getLocalizedDate(Date date,
Locale locale,
int nDateFormat)
Format a date according to the given locale
|
static String |
getLocalizedDateTime(Date date,
Locale locale,
int nDateFormat,
int nTimeFormat)
Format a date according to the given locale
|
static String |
getLocalizedString(String strKey,
Locale theLocale)
Returns the string corresponding to a given key for a given locale
Core key structure : portal.[admin, features, insert, rbac, search, site, style, system, users, util].key
Plugin key structure :[plugin].key
Module key structure :module.[plugin].[module].key
|
static String |
getLocalizedString(String strKey,
Object[] arguments,
Locale locale)
Returns the string corresponding to a given key for a given locale that use a MessageFormat pattern with arguments.
|
static String |
localize(String strSource,
Locale locale)
This method localize a string.
|
static Collection |
localizeCollection(Collection<? extends Localizable> collection,
Locale locale)
Localize all items of a list
|
static List |
localizeCollection(List<? extends Localizable> list,
Locale locale)
Localize all items of a list
|
static void |
resetCache()
Reset the caches
|
public static String localize(String strSource, Locale locale)
strSource
- The string that contains localization keyslocale
- The localepublic static String getLocalizedString(String strKey, Locale theLocale)
portal.[admin, features, insert, rbac, search, site, style, system, users, util].key
[plugin].key
module.[plugin].[module].key
strKey
- The key of the stringtheLocale
- The localepublic static String getLocalizedString(String strKey, Object[] arguments, Locale locale)
arguments
- The arguments used as values by the formatterstrKey
- The key of the string that contains the patternlocale
- The localepublic static String getLocalizedDate(Date date, Locale locale, int nDateFormat)
date
- The date to formatlocale
- The localenDateFormat
- A DateFormat constant corresponding to the expected format. (ie: DateFormat.FULL)public static String getLocalizedDateTime(Date date, Locale locale, int nDateFormat, int nTimeFormat)
date
- The date to formatlocale
- The localenDateFormat
- A DateFormat constant corresponding to the expected format. (ie: DateFormat.FULL)nTimeFormat
- A TimeFormat constant corresponding to the expected format. (ie: DateFormat.SHORT)public static List<Locale> getAdminAvailableLocales()
public static Locale getDefaultLocale()
public static String getDateFormatShortPattern(Locale locale)
locale
- The localepublic static ReferenceList getAdminLocales(Locale locale)
locale
- The locale to display available languagespublic static Collection localizeCollection(Collection<? extends Localizable> collection, Locale locale)
collection
- The list to localizelocale
- The localepublic static List localizeCollection(List<? extends Localizable> list, Locale locale)
list
- The list to localizelocale
- The localepublic static void resetCache()
Copyright © 2020 City of Paris. All rights reserved.