com.xmlmind.util
Class Localizer

java.lang.Object
  extended by com.xmlmind.util.Localizer

public final class Localizer
extends Object

Helper class used to create localized, formatted, messages.


Constructor Summary
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.
 
Method Summary
 String msg(String id)
          Returns localized message having specified ID.
 String msg(String id, Object... args)
          Returns localized message having specified ID and formatted using specified arguments.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.