|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.retek.commons.gui.util.TranslatorManager
This class encapsulates a property bundle and is used as the superclass of managers that handler translations (LanguageManager, MessageManager and Mnemonic Manager).
This class was designed so that the {filename}.properties file could contain actual english text directly with spaces, allowing programmers to use english labels during coding but automatically have these labels translated. It avoids the usage of tags and executes quickly for the en and en_US locale as the properties will be empty.
The currently assigned locale is used to determine the sequence of filenames used for language translation. For example, if the locale is set to the English language and United States as a country, and "lang" is passed in as a filename parameter, the language tool will attempt to load the following: lang_en.properties, and then lang_en_US.properties, and finally lang_en_US_??.properties where ?? is the variant in Locale. Keys in latter files override the keys in earlier files.
Retek Inc. Copyright (c) 2002
Field Summary | |
---|---|
protected static java.lang.String |
EMPTY
|
Constructor Summary | |
---|---|
TranslatorManager()
Returns new TranslatorManager object. |
|
TranslatorManager(java.util.Locale locale,
java.lang.String filename)
Returns new LanguageManager object. |
|
TranslatorManager(java.lang.String filename)
Returns new TranslatorManager object. |
Method Summary | |
---|---|
protected RPropertyBundle |
getBundle()
Retrieves the bundle being used by this manager. |
java.util.Locale |
getLocale()
Retrieves the locale information assigned to this language tool. |
boolean |
setBundle(java.lang.String filename)
Uses the filename to create a property bundle to retrieve translations from. |
void |
setLocale(java.util.Locale locale)
Sets the locale of the language tool. |
void |
setLocale(java.lang.String language,
java.lang.String country,
java.lang.String variant)
Sets the locale of the language tool. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String EMPTY
Constructor Detail |
public TranslatorManager()
public TranslatorManager(java.lang.String filename) throws UiBundleException
filename
- The filename of the properties file to load.
UiBusinessException
- Thrown if the method fails to load the property file.
UiBundleException
public TranslatorManager(java.util.Locale locale, java.lang.String filename) throws UiBundleException
locale
- The Locale to load the properties file for.filename
- The filename of the properties file to load.
UiBusinessException
- Thrown if the method fails to load the property file.
UiBundleException
Method Detail |
protected RPropertyBundle getBundle()
public boolean setBundle(java.lang.String filename) throws UiBundleException
filename
- The filename of a properties file.
UiBusinessException
- Thrown if a file error occurs in the underlying bundle.
UiBundleException
public void setLocale(java.lang.String language, java.lang.String country, java.lang.String variant)
language
- Lowercase two-letter ISO-639 code.country
- Uppercase two-letter ISO-3166 code.variant
- Vendor specific code.public void setLocale(java.util.Locale locale)
locale
- A locale object containg the locale information.public java.util.Locale getLocale()
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |