|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.denova.ui.LocaleTranslator
I18n for strings.
| Field Summary | |
static java.lang.String |
DefaultExtension
|
static java.lang.String |
DutchResources
|
static java.lang.String |
EnglishResources
|
static java.lang.String |
FrenchResources
|
static java.lang.String |
GermanResources
|
static java.lang.String |
ItalianResources
|
static java.lang.String |
JapaneseResources
|
static java.lang.String |
LocaleLog
|
static java.lang.String |
PolishResources
|
static java.lang.String |
PortugueseResources
|
static java.lang.String |
SpanishResources
|
| Constructor Summary | |
LocaleTranslator(java.lang.String extension)
Constructor to configure localized resources. |
|
| Method Summary | |
java.lang.String |
getActiveLanguage()
Get the active language (for example, english, spanish). |
java.lang.String |
getCountry()
Get the 2 letter ISO standard code for the active country. |
java.lang.String |
getDefaultLanguage()
Returns the default language to use if the user's default language isn't available. |
java.lang.String |
getLanguage()
Get the 2 letter ISO standard code for the active language. |
java.lang.String |
getLanguageExtension()
Returns the extension for language resource files. |
java.lang.String |
getString(java.lang.String key)
Get the value associated with key from the active language's resource. |
java.lang.String |
getString(java.lang.String key,
java.lang.String variable)
Get the value associated with key from the active language's resource. |
java.lang.String |
getString(java.lang.String key,
java.lang.String[] variables)
Get the value associated with key from the active language's resource. |
void |
setDefaultLanguage(java.lang.String newDefaultLanguage)
Set the default language to use if the user's default language isn't available. |
void |
setLanguageExtension(java.lang.String newFileExtension)
Set the file extension to use for the language files. |
void |
setLocale(java.lang.String newLanguage,
java.lang.String newCountry)
Set the language and country using the 2 letter ISO standard. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String EnglishResources
public static final java.lang.String SpanishResources
public static final java.lang.String GermanResources
public static final java.lang.String FrenchResources
public static final java.lang.String PolishResources
public static final java.lang.String JapaneseResources
public static final java.lang.String PortugueseResources
public static final java.lang.String ItalianResources
public static final java.lang.String DutchResources
public static final java.lang.String DefaultExtension
public static final java.lang.String LocaleLog
| Constructor Detail |
public LocaleTranslator(java.lang.String extension)
"extension" should be set to the file extension for your resources names. instantiating this class with the extension and including the files, the localized phrases can be displayed.
Currently supported languages (the filename follows):
English (english)
Dutch (dutch)
French (french)
German (german)
Italian (italian)
Japanese (japanese)
Polish (polish)
Portuguese (portuguese)
Spanish (spanish)
You should create a key=value pair file for each language. The filename for each language must use the same extension, and that extension may not be .properties. Each filename is the name of the language in all lower case.
extension - | Method Detail |
public void setLocale(java.lang.String newLanguage,
java.lang.String newCountry)
If you're going to vary the language, you should do so at the very beginning of the application.
newLanguage - new localenewCountry - new localepublic java.lang.String getLanguage()
public java.lang.String getCountry()
public void setDefaultLanguage(java.lang.String newDefaultLanguage)
If the language you set isn't available, then English is used.
newDefaultLanguage - new default languagepublic java.lang.String getDefaultLanguage()
public java.lang.String getActiveLanguage()
public void setLanguageExtension(java.lang.String newFileExtension)
newFileExtension - new language extensionpublic java.lang.String getLanguageExtension()
public java.lang.String getString(java.lang.String key)
If the active language doesn't have a matching key, then it returns the key from the English resources (e.g., english.extension).
key -
public java.lang.String getString(java.lang.String key,
java.lang.String variable)
Replace any %VARIABLE% strings with the variable.
If the active language doesn't have a matching key, then it returns the key from the English resources (e.g., english.extension).
key - attribute of the av pair of stringsvariable - a string to use to replace %VARIABLE%
public java.lang.String getString(java.lang.String key,
java.lang.String[] variables)
Replace any %VARIABLE% strings with the list of variables. If there are multiple variables, then they are used in sequential order. If there are more %VARIABLE% literals than in the variables list, then the last variable in the list is used for the remaining literals.
If the active language doesn't have a matching key, then it returns the key from the English resources (e.g., english.extension).
key - attribute of the av pair of stringsvariables - one or more strings to use to replace %VARIABLE%
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||