infrastructure.internationalization
Class InternationalizationManager

java.lang.Object
  extended byinfrastructure.internationalization.InternationalizationManager

public class InternationalizationManager
extends java.lang.Object

Class to handle internationalization. Uses the property manager to set the default locale. Set the default locale using locale.language = en and locale.country = UK. If locale has not been set in the property manager, it uses the JVM default locale

Author:
amangat

Method Summary
static InternationalizationManager getInstance()
          Returns the singleton
 java.lang.String getMessage(java.lang.String category, java.lang.String messageKey, java.lang.Object[] arguments)
          Get the internationalized message.
 void initializeInternationalizationManager(java.io.InputStream propertiesFileInputStream)
          Initialize the resource bundle by processing all the files specified in the 'propertiesFileInputStream'.
 void initializeResourceBundle(java.lang.String category, java.io.InputStream propertiesFileInputStream)
          Initialize the resource bundle by reading name-value pairs from the specified input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static InternationalizationManager getInstance()
Returns the singleton

Returns:

initializeInternationalizationManager

public void initializeInternationalizationManager(java.io.InputStream propertiesFileInputStream)
                                           throws java.io.IOException
Initialize the resource bundle by processing all the files specified in the 'propertiesFileInputStream'. Sample contents of the file are:

dbbrowser-core=dbbrowser-core_en_UK.properties dbbrowser-ui=dbbrowser-ui_en_UK.properties
The methos will call the method 'initializeResourceBundle' with input stream from the two files above as a parameter.

Parameters:
propertiesFileInputStream -
Throws:
java.io.IOException

initializeResourceBundle

public void initializeResourceBundle(java.lang.String category,
                                     java.io.InputStream propertiesFileInputStream)
                              throws java.io.IOException
Initialize the resource bundle by reading name-value pairs from the specified input stream. More than one resource bundle can be initialized - one for each category representing a 'component' or a 'UI screen'. Use the 'category' name when retrieving message

Parameters:
category -
propertiesFileInputStream -
Throws:
java.io.IOException

getMessage

public java.lang.String getMessage(java.lang.String category,
                                   java.lang.String messageKey,
                                   java.lang.Object[] arguments)
Get the internationalized message. This method does the following:
1. Lookup the resource bundle using the category name
2. Lookup the message from the resource bundle
Returns null if no message found

Parameters:
category -
messageKey -
arguments -
Returns: