com.opencms.workplace
Class CmsXmlLanguageFile

java.lang.Object
  |
  +--com.opencms.workplace.CmsXmlLanguageFile

public class CmsXmlLanguageFile
extends Object


Field Summary
static String C_BUNDLE_NAME
          The name of the property file
 
Constructor Summary
CmsXmlLanguageFile(CmsObject cms)
          Constructor for creating a new language file initialized with the workplace preferences locale of the current user.
CmsXmlLanguageFile(CmsObject cms, String locale)
          Constructor for creating a new language file initialized with the provided locale.
 
Method Summary
static String getCurrentUserLanguage(CmsObject cms)
          Returns the language set for the current user.
 String getEncoding()
          Returns the content encoding defined for this language.
 String getLanguageValue(String keyName)
          Returns the language value of the requested label key.
 CmsMessages getMessages()
          Returns the messages initialized for this language file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

C_BUNDLE_NAME

public static final String C_BUNDLE_NAME
The name of the property file

See Also:
Constant Field Values
Constructor Detail

CmsXmlLanguageFile

public CmsXmlLanguageFile(CmsObject cms)
                   throws CmsException
Constructor for creating a new language file initialized with the workplace preferences locale of the current user.

Parameters:
cms - for accessing system resources

CmsXmlLanguageFile

public CmsXmlLanguageFile(CmsObject cms,
                          String locale)
                   throws CmsException
Constructor for creating a new language file initialized with the provided locale.

Parameters:
cms - for accessing system resources
locale - the locale to initialize
Method Detail

getEncoding

public String getEncoding()
Returns the content encoding defined for this language.

Returns:
String the the content encoding defined for this language

getMessages

public CmsMessages getMessages()
Returns the messages initialized for this language file.

Returns:
CmsMessages the messages initialized for this language file

getLanguageValue

public String getLanguageValue(String keyName)
Returns the language value of the requested label key.

Parameters:
keyName - the key for the desired string
Returns:
the resource string for the given key

getCurrentUserLanguage

public static String getCurrentUserLanguage(CmsObject cms)
Returns the language set for the current user.

This is look up in the following places:

  1. the current users session
  2. the current users workplace preferences
  3. the current users browser settings
If a result is found it is stored in the users session.

Parameters:
cms - for accessing system resources
Returns:
2-letter ISO code of the preferred language (e.g. "en", "de", ...)