java.lang.Object
net.bull.javamelody.internal.common.I18N

public final class I18N extends Object
Classe de gestion des traductions et de l'internationalisation (formats de dates et de nombre). La locale pour les rapports vient de la requête et est associée au thread courant.
Author:
Emeric Vernat
  • Method Details

    • bindLocale

      public static void bindLocale(Locale locale)
      Définit la locale (langue et formats dates et nombres) pour le thread courant.
      Parameters:
      locale - Locale
    • getCurrentLocale

      public static Locale getCurrentLocale()
      Retourne la locale pour le thread courant ou la locale par défaut si elle n'a pas été définie.
      Returns:
      Locale
    • getResourceBundle

      public static ResourceBundle getResourceBundle()
      Retourne les traductions pour la locale courante.
      Returns:
      Locale
    • unbindLocale

      public static void unbindLocale()
      Enlève le lien entre la locale et le thread courant.
    • getString

      public static String getString(String key)
      Retourne une traduction dans la locale courante.
      Parameters:
      key - clé d'un libellé dans les fichiers de traduction
      Returns:
      String
    • getFormattedString

      public static String getFormattedString(String key, Object... arguments)
      Retourne une traduction dans la locale courante et insère les arguments aux positions {i}.
      Parameters:
      key - clé d'un libellé dans les fichiers de traduction
      arguments - Valeur à inclure dans le résultat
      Returns:
      String
    • urlEncode

      public static String urlEncode(String text)
    • htmlEncode

      public static String htmlEncode(String text, boolean encodeSpace, boolean encodeNewLine)
      Encode pour affichage en html.
      Parameters:
      text - message à encoder
      encodeSpace - 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 br
      Returns:
      String
    • htmlEncode

      public static String htmlEncode(String text, boolean encodeSpace)
      Encode pour affichage en html.
      Parameters:
      text - message à encoder
      encodeSpace - booléen selon que les espaces sont encodés en nbsp (insécables)
      Returns:
      String
    • writeTo

      public static void writeTo(String html, Writer writer) throws IOException
      É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.
      Parameters:
      html - texte html avec éventuellement des #clé#
      writer - flux
      Throws:
      IOException - e
    • writelnTo

      public static void writelnTo(String html, Writer writer) throws IOException
      É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.
      Parameters:
      html - texte html avec éventuellement des #clé#
      writer - flux
      Throws:
      IOException - e
    • createIntegerFormat

      public static DecimalFormat createIntegerFormat()
    • createPercentFormat

      public static DecimalFormat createPercentFormat()
    • createDateFormat

      public static DateFormat createDateFormat()
    • createDateAndTimeFormat

      public static DateFormat createDateAndTimeFormat()
    • createDurationFormat

      public static DateFormat createDurationFormat()
    • getCurrentDate

      public static String getCurrentDate()
    • getCurrentDateAndTime

      public static String getCurrentDateAndTime()