Class Localizer


  • public final class Localizer
    extends Object
    Helper class used to create localized, formatted, messages.
    • Constructor Detail

      • Localizer

        public Localizer​(Class<?> cls)
        Constructs a Localizer which uses java.text.MessageFormats found in package_name.Messages_locale.properties java.util.ResourceBundles to create its localized, formatted, messages.

        Example: com.xmlmind.foo.Messages_fr.properties, which is used to create localized, formatted, messages for all classes in the com.xmlmind.foo package, contains 2 message formats having cannotOpen and cannotSave as their IDs.

        cannotOpen=Ne peut ouvrir le fichier "{0}":\n{1}
        
        cannotSave=Ne peut enregistrer le fichier "{0}":\n{1}
        Parameters:
        cls - Class used to specify package_name.
    • Method Detail

      • msg

        public String msg​(String id)
        Returns localized message having specified ID. Returns specified ID if the message is not found.
      • msg

        public String msg​(String id,
                          Object... args)
        Returns localized message having specified ID and formatted using specified arguments. Returns specified ID if the message is not found.