com.lgc.wsh.util
Class Localize

java.lang.Object
  extended by com.lgc.wsh.util.Localize

public class Localize
extends java.lang.Object

Filter a string with specified ResourceBundles.


Constructor Summary
Localize()
           
 
Method Summary
static java.lang.String filter(java.lang.String message, java.lang.Class<?> resourceClass)
          Filter the specified string with a ResourceBundle for the specified class.
static java.lang.String filter(java.lang.String message, java.util.ResourceBundle catalog)
          Filter the specified string with the specified resource bundle.
static java.lang.String timeWords(long seconds)
          Convert a number of seconds into words
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Localize

public Localize()
Method Detail

filter

public static java.lang.String filter(java.lang.String message,
                                      java.util.ResourceBundle catalog)
Filter the specified string with the specified resource bundle. First the entire string is filtered, then substrings delimited as ${key} are filtered.

Parameters:
message - Filter this string
catalog - Get keys and values from this.
Returns:
Filtered string.

filter

public static java.lang.String filter(java.lang.String message,
                                      java.lang.Class<?> resourceClass)
Filter the specified string with a ResourceBundle for the specified class. First the entire string is filtered, then substrings delimited as ${key} are filtered.

Parameters:
message - Filter this string
resourceClass - Use the class loader for this class and load a localized PropertyResourceBundle with the same name as the class. For example, a class Foo has a Foo.properties and a Foo_ch.properties file in the same directory as the compiled Foo.class. Test with java -Duser.language=ch
Returns:
Filtered string.

timeWords

public static java.lang.String timeWords(long seconds)
Convert a number of seconds into words

Parameters:
seconds - Number of seconds
Returns:
Localized words describing the number of seconds.