com.imcode.imcms.api
Class I18nSupport

java.lang.Object
  extended by com.imcode.imcms.api.I18nSupport

public class I18nSupport
extends java.lang.Object

I18n support. This class intended to be used as a singleton and can not be instantiated.

Author:
Anton Josua
See Also:
ImcmsSetupFilter

Method Summary
static I18nLanguage getByCode(java.lang.String code)
           
static I18nLanguage getById(java.lang.Integer id)
           
static boolean getCurrentIsDefault()
           
static I18nLanguage getCurrentLanguage()
          Returns I18nLanguage instance bound to the current thread.
static I18nLanguage getDefaultLanguage()
          Returns default language.
static java.util.List<I18nLanguage> getLanguages()
           
static boolean isCurrent(I18nLanguage language)
          Return if tested language is current.
static boolean isDefault(I18nLanguage language)
          Return if tested language is default.
static boolean isEnabled()
           
static void setCurrentLanguage(I18nLanguage language)
          Bounds I18nLanguage instance to the current thread.
static void setDefaultLanguage(I18nLanguage language)
          Sets default language.
static void setLanguages(java.util.List<I18nLanguage> languages)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setDefaultLanguage

public static void setDefaultLanguage(I18nLanguage language)
                               throws java.lang.IllegalArgumentException
Sets default language. When application running in container default language should be set during setup.

Parameters:
language - default language.
Throws:
java.lang.IllegalArgumentException - in case of attempt to assign null to default language.

getDefaultLanguage

public static I18nLanguage getDefaultLanguage()
                                       throws I18nException
Returns default language.

Throws:
I18nException

getCurrentLanguage

public static I18nLanguage getCurrentLanguage()
                                       throws I18nException
Returns I18nLanguage instance bound to the current thread.

Throws:
I18nException - if no I18nLanguage instance is bound to the current thread

setCurrentLanguage

public static void setCurrentLanguage(I18nLanguage language)
                               throws java.lang.IllegalArgumentException
Bounds I18nLanguage instance to the current thread.

Throws:
java.lang.IllegalArgumentException - in case of attempt to assign null to current language.

isDefault

public static boolean isDefault(I18nLanguage language)
Return if tested language is default.


isCurrent

public static boolean isCurrent(I18nLanguage language)
Return if tested language is current.


getLanguages

public static java.util.List<I18nLanguage> getLanguages()

setLanguages

public static void setLanguages(java.util.List<I18nLanguage> languages)

getByCode

public static I18nLanguage getByCode(java.lang.String code)

getById

public static I18nLanguage getById(java.lang.Integer id)

isEnabled

public static boolean isEnabled()

getCurrentIsDefault

public static boolean getCurrentIsDefault()