|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecttranslator.Translator
public class Translator
Provides internationalization by translating messages. Requires an appropriate resource file containing the message translations.
| Field Summary | |
|---|---|
static java.util.Locale |
DEFAULT_LOCALE
The current locale, responsible for element translation |
(package private) java.lang.String |
resourceBaseName
The base name of the resource to load |
| Constructor Summary | |
|---|---|
Translator()
|
|
Translator(java.lang.String resourceName,
java.util.Locale targetLocale)
|
|
| Method Summary | |
|---|---|
java.util.Locale |
getCurrentLocale()
Retrieve the current locale. |
TranslatableGUIElement |
getGenerator()
returns the current TranslatableGUIElement instance for this Translator |
ExtendedResourceManagement |
getResourceBundle()
Return the current ExtendedResourceBundle for translation purposes |
void |
listUnknownResources()
Lists the unknown resources for all known locales to the standard output |
void |
setResourceBaseName(java.lang.String resourceName)
|
void |
setTranslatorLocale(java.util.Locale targetLocale)
Set the current locale to the one passed in This will also translate all GUI components if the state of the Translator is 'initialized' |
void |
setTranslatorLocale(java.util.Locale targetLocale,
java.util.Vector<java.lang.String> additionalResources)
Set the current locale to the one passed in This will also translate all GUI components if the state of the Translator is 'initialized' |
java.lang.String |
translateMessage(java.lang.String messageKey)
Convenience wrapper the translated message of key messageKey. |
java.lang.String |
translateMessage(java.lang.String messageKey,
java.lang.Object[] messageParams)
Return the translated message of key messageKey using the message params Internally invokes generateMessage(messageKey, null); |
java.lang.String |
translateMessage(java.lang.String messageKey,
java.lang.Object[] messageParams,
boolean warnOnError)
Return the translated message of key messageKey using the message params |
java.lang.String |
translateMessage(java.lang.String messageKey,
java.lang.String... params)
Return the translated message of key messageKey using the message params Internally invokes generateMessage(messageKey, null); |
java.lang.String |
translateMessageWithoutParameterExpansion(java.lang.String messageKey)
Convenience wrapper the translated message of key messageKey. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.util.Locale DEFAULT_LOCALE
java.lang.String resourceBaseName
| Constructor Detail |
|---|
public Translator()
public Translator(java.lang.String resourceName,
java.util.Locale targetLocale)
| Method Detail |
|---|
public java.util.Locale getCurrentLocale()
public TranslatableGUIElement getGenerator()
public ExtendedResourceManagement getResourceBundle()
public void listUnknownResources()
public void setTranslatorLocale(java.util.Locale targetLocale)
targetLocale - the new locale for the application. If null, uses Locale.US
instead
public void setTranslatorLocale(java.util.Locale targetLocale,
java.util.Vector<java.lang.String> additionalResources)
targetLocale - the new locale for the application. If null, uses Locale.US
insteadadditionalResources - the file names (without ".xx_YY") for additional
language resources to be read inpublic void setResourceBaseName(java.lang.String resourceName)
public java.lang.String translateMessageWithoutParameterExpansion(java.lang.String messageKey)
messageKey - the key of the message to be displayedtranslateMessage(String, Object[], boolean)public java.lang.String translateMessage(java.lang.String messageKey)
messageKey - the key of the message to be displayedtranslateMessage(String, Object[], boolean)
public java.lang.String translateMessage(java.lang.String messageKey,
java.lang.Object[] messageParams)
messageKey - the key of the message to be displayedmessageParams - the values to be substituted into the message.translateMessage(String, Object[], boolean)
public java.lang.String translateMessage(java.lang.String messageKey,
java.lang.String... params)
messageKey - the key of the message to be displayedparams - the values to be substituted into the message.translateMessage(String, Object[], boolean)
public java.lang.String translateMessage(java.lang.String messageKey,
java.lang.Object[] messageParams,
boolean warnOnError)
messageKey - the key of the message to be displayedmessageParams - the values to be substituted into the message.warnOnError - if true, log warnings due to invalid accesses or unavailable keys.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||