public class MLText
extends java.util.HashMap
The language codes used should conform to the ISO639-2 language code standard, although there is no enforcement of the standard in this class.
This is a simple extension of a HashMap
with a few convenience methods.
Constructor and Description |
---|
MLText() |
MLText(java.util.Locale locale,
java.lang.String value)
Construct an instance with a value for the given locale.
|
MLText(java.lang.String value)
Construct an instance with a value corresponding to the current context locale.
|
Modifier and Type | Method and Description |
---|---|
void |
addValue(java.util.Locale locale,
java.lang.String value)
Add a multilingual text value
|
java.lang.String |
getClosestValue(java.util.Locale locale)
The given locale is used to search for a matching value according to:
An exact locale match
A match of locale ISO language codes
The value for the locale provided in the
constructor
An arbitrary value
null
|
java.lang.String |
getDefaultValue()
Retrieves a default value from the set of available locales.
|
java.util.Set |
getLocales() |
java.lang.String |
getValue(java.util.Locale locale)
Retrieve a multilingual text value
|
java.util.Collection |
getValues() |
void |
removeValue(java.util.Locale locale)
Remove a multilingual text value
|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
public MLText()
public MLText(java.lang.String value)
value
- the value for the current default localeI18NUtil.getLocale()
,
MLText.MLText(Locale, String)
,
MLText.getDefaultValue()
public MLText(java.util.Locale locale, java.lang.String value)
locale
- the localevalue
- the valueMLText.getDefaultValue()
public java.util.Set getLocales()
public java.util.Collection getValues()
public void addValue(java.util.Locale locale, java.lang.String value)
locale
- the language localevalue
- the multilingual textpublic java.lang.String getValue(java.util.Locale locale)
locale
- the language localepublic java.lang.String getDefaultValue()
I18NUtil.getLocale()
,
MLText.getClosestValue(Locale)
public java.lang.String getClosestValue(java.util.Locale locale)
constructor
locale
- the locale to use as the starting point of the value searchpublic void removeValue(java.util.Locale locale)
locale
- the language localeCopyright © 2005 - 2013 Alfresco Software, Inc. All Rights Reserved.