public final class I18N extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
bindLocale(Locale locale)
Définit la locale (langue et formats dates et nombres) pour le thread courant.
|
static DateFormat |
createDateAndTimeFormat() |
static DateFormat |
createDateFormat() |
static DateFormat |
createDurationFormat() |
static DecimalFormat |
createIntegerFormat() |
static DecimalFormat |
createPercentFormat() |
static String |
getCurrentDate() |
static String |
getCurrentDateAndTime() |
static Locale |
getCurrentLocale()
Retourne la locale pour le thread courant ou la locale par défaut si elle n'a pas été définie.
|
static String |
getFormattedString(String key,
Object... arguments)
Retourne une traduction dans la locale courante et insère les arguments aux positions {i}.
|
static ResourceBundle |
getResourceBundle()
Retourne les traductions pour la locale courante.
|
static String |
getString(String key)
Retourne une traduction dans la locale courante.
|
static String |
htmlEncode(String text,
boolean encodeSpace)
Encode pour affichage en html.
|
static String |
htmlEncode(String text,
boolean encodeSpace,
boolean encodeNewLine)
Encode pour affichage en html.
|
static void |
unbindLocale()
Enlève le lien entre la locale et le thread courant.
|
static String |
urlEncode(String text) |
static void |
writelnTo(String html,
Writer writer)
Écrit un texte, puis un retour chariot, dans un flux en remplaçant dans le texte les clés entourées de deux '#'
par leurs traductions dans la locale courante.
|
static void |
writeTo(String html,
Writer writer)
Écrit un texte dans un flux en remplaçant dans le texte les clés entourées de deux '#'
par leurs traductions dans la locale courante.
|
public static void bindLocale(Locale locale)
locale - Localepublic static Locale getCurrentLocale()
public static ResourceBundle getResourceBundle()
public static void unbindLocale()
public static String getString(String key)
key - clé d'un libellé dans les fichiers de traductionpublic static String getFormattedString(String key, Object... arguments)
key - clé d'un libellé dans les fichiers de traductionarguments - Valeur à inclure dans le résultatpublic static String htmlEncode(String text, boolean encodeSpace, boolean encodeNewLine)
text - message à encoderencodeSpace - booléen selon que les espaces sont encodés en nbsp (insécables)encodeNewLine - booléen selon que les retours à la ligne sont encodés en brpublic static String htmlEncode(String text, boolean encodeSpace)
text - message à encoderencodeSpace - booléen selon que les espaces sont encodés en nbsp (insécables)public static void writeTo(String html, Writer writer) throws IOException
html - texte html avec éventuellement des #clé#writer - fluxIOException - epublic static void writelnTo(String html, Writer writer) throws IOException
html - texte html avec éventuellement des #clé#writer - fluxIOException - epublic static DecimalFormat createIntegerFormat()
public static DecimalFormat createPercentFormat()
public static DateFormat createDateFormat()
public static DateFormat createDateAndTimeFormat()
public static DateFormat createDurationFormat()
public static String getCurrentDate()
public static String getCurrentDateAndTime()
Copyright © 2008–2021 Emeric Vernat. All rights reserved.