|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlacam.language.Dictionary
This class represents the dictionary of the whole system.
Using a Properties
it can store and load easy to write language packs, which
just need to follow the Syntax Properties
can read and use the in DictionaryConstants
described keys to overwrite default values set in DefaultDictionary
Field Summary | |
static java.util.Properties |
FACTOR_TYPE_MAP
|
static java.lang.String |
PLACEHOLDER_PLUGIN_HOME
The placeholder which will be replaced by the plugins name |
static java.lang.String |
PLACEHOLDER_SCRIPTS_HOME
|
static java.lang.String |
PLACEHOLDER_SYSTEM_HOME
|
static java.lang.String |
PLACEHOLDER_USER_HOME
|
static java.lang.String |
PLACEHOLDER_USER_NAME
|
Constructor Summary | |
Dictionary()
|
Method Summary | |
static java.util.Properties |
addPluginLanguagePack(java.io.InputStream language_pack_stream)
Adds a plugin language pack to the default dictionary |
static java.util.Properties |
addPluginLanguagePack(java.util.Properties plugin_pack)
Adds a plugin language pack to the default dictionary |
static void |
addPluginLanguagePack(java.util.Properties default_dictionary,
java.lang.String language_pack_loc)
Adds a plugin language pack to the systems dictionary. |
static java.lang.String |
getExpression(java.lang.String key)
Use this method to access expression stored in the dictionary |
static java.lang.String |
getExpression(java.lang.String key,
java.lang.Object[] values)
Formats the expression found for the key with the values given in values . |
static java.lang.String |
getExpression(java.lang.String key,
java.lang.String default_value)
Returns the expression defined through the key key and
returns default_value if expression was found |
static java.lang.String |
getExpression(java.lang.String key,
java.lang.String default_expression,
java.lang.Object[] values)
Formats the expression found for the key with the values given in values and uses
default_expresion if no expression was found for the key. |
static java.lang.String |
getHelpPath(java.lang.String key,
java.lang.String plugin_loc)
|
static java.util.Locale |
getLocale()
|
static boolean |
loadLanguagePack()
Reloads the default language pack of the system |
static boolean |
loadLanguagePack(java.lang.String file)
Sets the default langauge pack to file
and reloads the language pack |
static java.lang.String |
parseLocalizedString(java.lang.String definition)
Parses the localized String out of the given definition list. |
static void |
removePluginLanguagePack(java.util.Properties plugin_pack)
Deprecated. |
static java.lang.String |
replacePlaceholders(java.lang.String expression,
java.lang.String plugin_name)
Replaces possible system placeholders in the String expression .
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static java.util.Properties FACTOR_TYPE_MAP
public static final java.lang.String PLACEHOLDER_PLUGIN_HOME
public static final java.lang.String PLACEHOLDER_SYSTEM_HOME
public static final java.lang.String PLACEHOLDER_SCRIPTS_HOME
public static final java.lang.String PLACEHOLDER_USER_HOME
public static final java.lang.String PLACEHOLDER_USER_NAME
Constructor Detail |
public Dictionary()
Method Detail |
public static boolean loadLanguagePack(java.lang.String file)
file
and reloads the language pack
file
- the path to the fileloadLanguagePack()
public static java.util.Properties addPluginLanguagePack(java.io.InputStream language_pack_stream)
language_pack_stream
- the stream pointing at the language packProperties.load(java.io.InputStream)
public static java.lang.String getExpression(java.lang.String key, java.lang.String default_value)
key
and
returns default_value
if expression was found
key
- the key to the expressiondefault_value
- the default return value if nothing foundDictionaryConstants
public static java.lang.String getExpression(java.lang.String key, java.lang.String default_expression, java.lang.Object[] values)
values
and uses
default_expresion
if no expression was found for the key.
key
- The key to access the needed value in the dictionarydefault_expression
- The default value if no value could be foundvalues
- The values to use for replacing
MessageFormat
,
getExpression(String, String)
public static java.lang.String getExpression(java.lang.String key, java.lang.Object[] values)
values
.
key
- The key to access the needed value in the dictionaryvalues
- The values to use for replacing
MessageFormat
,
getExpression(String, String)
public static java.lang.String getExpression(java.lang.String key)
key
- the key to the expression
getExpression(String, String)
,
DictionaryConstants
,
Properties.getProperty(java.lang.String)
public static boolean loadLanguagePack()
loadLanguagePack(String)
public static void addPluginLanguagePack(java.util.Properties default_dictionary, java.lang.String language_pack_loc)
default_dictionary
parameter as the default dictionary of the plugin
and overwrites the values of the default_dictionary
with values of the found in the dictionary
found at language_pack_loc
.
default_dictionary
- The default dictionary of the pluginlanguage_pack_loc
- The language pack wich should be loaded to overwrite default valuespublic static java.util.Properties addPluginLanguagePack(java.util.Properties plugin_pack)
plugin_pack
- the plugins language packpublic static void removePluginLanguagePack(java.util.Properties plugin_pack)
plugin_pack
- the plugins language packpublic static java.lang.String parseLocalizedString(java.lang.String definition)
DE?"file:///${plugin_home}/language/german.lp";"http://www.my_home.uk/uk.lp"
defines that the plugin has 2 language packs. If the systems locale is DE the language pack at the location "file:///${plugin_home}/language/german.lp" will be chosen. If the systems local is amy other the language pack will be downloaded (if allowed) from http://www.my_home.uk/uk.lp.
definition
- The definition list
public static java.lang.String getHelpPath(java.lang.String key, java.lang.String plugin_loc)
key
- The key to find the help file path in the dictionaryplugin_loc
- The location of the Plugin
public static java.util.Locale getLocale()
public static java.lang.String replacePlaceholders(java.lang.String expression, java.lang.String plugin_name)
expression
.
Possible placeholders are | |
${plugin_home} | The home folder of the calling plugin |
${system_home} | The systems home folder @link System#getProperty(java.lang.String) |
${scripts_home} | The folder where the systems scripts can be found as *.dtd and *.xslt |
${user_home} | The current users home directory |
${user_name} | The current users name |
expression
- The expression in which the placeholders should be replacedplugin_name
- The calling Plugins name
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |