org.jtheque.core.managers.language
Class LanguageManager

java.lang.Object
  extended by org.jtheque.core.managers.language.LanguageManager
All Implemented Interfaces:
IManager, ILanguageManager

public final class LanguageManager
extends java.lang.Object
implements ILanguageManager, IManager

Author:
Baptiste Wicht

Constructor Summary
LanguageManager()
          Construct a new ResourceManager.
 
Method Summary
 void addBasename(java.lang.String basename)
          Add an internationalization base name.
 void addInternationalizable(Internationalizable internationalizable)
          Add an internationalizable element.
 void close()
          Close the manager.
 java.lang.String getCurrentLanguage()
          Return the current language.
 java.util.Locale getCurrentLocale()
          Return the current locale.
 java.lang.String[] getLinesMessage(java.lang.String key)
          Return all the lines of a message.
 java.lang.String getMessage(java.lang.String key)
          Return the message of the key.
 java.lang.String getMessage(java.lang.String key, java.lang.Object... replaces)
          Return the message of the key and effect the replaces.
 java.util.List<java.lang.String> getPossibleLanguages()
          Return all the supported languages.
 void init()
          Init the manager.
 void preInit()
          Pre-init the manager.
 void removeBasename(java.lang.String basename)
          Remove a basename.
 void setCurrentLanguage(java.lang.String language)
          Set the current language.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LanguageManager

public LanguageManager()
Construct a new ResourceManager.

Method Detail

preInit

public void preInit()
Description copied from interface: IManager
Pre-init the manager. This operation is called before modules preplug.

Specified by:
preInit in interface IManager

init

public void init()
          throws ManagerException
Description copied from interface: IManager
Init the manager. This operation is called after modules preplug but before module plug.

Specified by:
init in interface IManager
Throws:
ManagerException - If an error occurs during the init process.

close

public void close()
           throws ManagerException
Description copied from interface: IManager
Close the manager.

Specified by:
close in interface IManager
Throws:
ManagerException - If an error occurs during the close process.

addBasename

public void addBasename(java.lang.String basename)
Description copied from interface: ILanguageManager
Add an internationalization base name.

Specified by:
addBasename in interface ILanguageManager
Parameters:
basename - The basename to add.

removeBasename

public void removeBasename(java.lang.String basename)
Description copied from interface: ILanguageManager
Remove a basename.

Specified by:
removeBasename in interface ILanguageManager
Parameters:
basename - The basename to remove.

setCurrentLanguage

public void setCurrentLanguage(java.lang.String language)
Description copied from interface: ILanguageManager
Set the current language.

Specified by:
setCurrentLanguage in interface ILanguageManager
Parameters:
language - The language.

addInternationalizable

public void addInternationalizable(Internationalizable internationalizable)
Description copied from interface: ILanguageManager
Add an internationalizable element.

Specified by:
addInternationalizable in interface ILanguageManager
Parameters:
internationalizable - The internationalizable to add.

getCurrentLocale

public java.util.Locale getCurrentLocale()
Description copied from interface: ILanguageManager
Return the current locale.

Specified by:
getCurrentLocale in interface ILanguageManager
Returns:
The current locale.

getCurrentLanguage

public java.lang.String getCurrentLanguage()
Description copied from interface: ILanguageManager
Return the current language.

Specified by:
getCurrentLanguage in interface ILanguageManager
Returns:
The current language.

getMessage

public java.lang.String getMessage(java.lang.String key)
Description copied from interface: ILanguageManager
Return the message of the key. If there is no message with this key, the method return the key and log the message to the log system.

Specified by:
getMessage in interface ILanguageManager
Parameters:
key - The message key.
Returns:
The message of the key of the current locale, empty string if the key is null else the key if there is no message for this key.

getLinesMessage

public java.lang.String[] getLinesMessage(java.lang.String key)
Description copied from interface: ILanguageManager
Return all the lines of a message. The end line character used is \n.

Specified by:
getLinesMessage in interface ILanguageManager
Parameters:
key - The key of the message.
Returns:
An array containing all the lines of the internationalized message.

getMessage

public java.lang.String getMessage(java.lang.String key,
                                   java.lang.Object... replaces)
Description copied from interface: ILanguageManager
Return the message of the key and effect the replaces.

Specified by:
getMessage in interface ILanguageManager
Parameters:
key - The message key.
replaces - The replacements.
Returns:
The message of the current locale with the replacements.

getPossibleLanguages

public java.util.List<java.lang.String> getPossibleLanguages()
Description copied from interface: ILanguageManager
Return all the supported languages.

Specified by:
getPossibleLanguages in interface ILanguageManager
Returns:
A List containing all the supported languages.


Copyright © 2009 JTheque. All Rights Reserved.