Liferay 7.0-ce-b4

com.liferay.portal.util
Class LocalizationImpl

java.lang.Object
  extended by com.liferay.portal.util.LocalizationImpl
All Implemented Interfaces:
Localization

public class LocalizationImpl
extends Object
implements Localization


Constructor Summary
LocalizationImpl()
           
 
Method Summary
 Object deserialize(JSONObject jsonObject)
          Deserializes the JSON object into a map of locales and localized strings.
 String[] getAvailableLanguageIds(Document document)
           
 String[] getAvailableLanguageIds(String xml)
          Returns the available locales from the localizations XML.
 Locale getDefaultImportLocale(String className, long classPK, Locale contentDefaultLocale, Locale[] contentAvailableLocales)
          Returns a valid default locale for importing a localized entity.
 String getDefaultLanguageId(Document document)
           
 String getDefaultLanguageId(Document document, Locale defaultLocale)
           
 String getDefaultLanguageId(String xml)
          Returns the default locale from the localizations XML.
 String getDefaultLanguageId(String xml, Locale defaultLocale)
           
 String getLocalization(String xml, String requestedLanguageId)
          Returns the localized string from the localizations XML in the language.
 String getLocalization(String xml, String requestedLanguageId, boolean useDefault)
          Returns the localized string from the localizations XML in the language, optionally using the default language if no localization exists for the requested language.
 String getLocalization(String xml, String requestedLanguageId, boolean useDefault, String defaultValue)
          Returns the localized string from the localizations XML in the language, optionally using the default language if no localization exists for the requested language.
 Map<Locale,String> getLocalizationMap(Collection<Locale> locales, Locale defaultLocale, String key)
          Returns a map of locales and localized strings for the key.
 Map<Locale,String> getLocalizationMap(javax.servlet.http.HttpServletRequest request, String parameter)
          Returns a map of locales and localized strings for the parameter in the request.
 Map<Locale,String> getLocalizationMap(PortletPreferences preferences, String preferenceName)
          Returns a map of locales and localized strings for the preference in the preferences container.
 Map<Locale,String> getLocalizationMap(PortletPreferences preferences, String preferenceName, String propertyName)
          Returns a map of locales and localized strings for the preference in the preferences container.
 Map<Locale,String> getLocalizationMap(PortletPreferences preferences, String preferenceName, String propertyName, String defaultPropertyValue, ClassLoader classLoader)
           
 Map<Locale,String> getLocalizationMap(PortletRequest portletRequest, String parameter)
          Returns a map of locales and localized strings for the parameter in the portlet request.
 Map<Locale,String> getLocalizationMap(PortletRequest portletRequest, String parameter, Map<Locale,String> defaultValues)
           
 Map<Locale,String> getLocalizationMap(String xml)
          Returns a map of locales and localized strings from the localizations XML.
 Map<Locale,String> getLocalizationMap(String[] languageIds, String[] values)
          Returns a map of locales and localized strings for the given languageIds and values.
 Map<Locale,String> getLocalizationMap(String xml, boolean useDefault)
           
 Map<Locale,String> getLocalizationMap(String bundleName, ClassLoader classLoader, String key, boolean includeBetaLocales)
           
 String getLocalizationXmlFromPreferences(PortletPreferences preferences, PortletRequest portletRequest, String parameter)
          Returns the localizations XML for the parameter from the portlet request, attempting to get data from the preferences container if it is not available in the portlet request.
 String getLocalizationXmlFromPreferences(PortletPreferences preferences, PortletRequest portletRequest, String parameter, String defaultValue)
          Returns the localizations XML for the parameter from the portlet request, attempting to get data from the preferences container if it is not available in the portlet request.
 String getLocalizationXmlFromPreferences(PortletPreferences preferences, PortletRequest portletRequest, String parameter, String prefix, String defaultValue)
          Returns the localizations XML for the prefixed parameter from the portlet request, attempting to get data from the preferences container if it is not available in the portlet request.
 String getLocalizedName(String name, String languageId)
          Returns the localized name in the language.
 Map<Locale,String> getLocalizedParameter(PortletRequest portletRequest, String parameter)
          Deprecated. As of 7.0.0
 Map<Locale,String> getMap(LocalizedValuesMap localizedValuesMap)
           
 String getPreferencesKey(String key, String languageId)
          Deprecated. As of 7.0.0
 String getPreferencesValue(PortletPreferences preferences, String key, String languageId)
          Returns the localized preferences value for the key in the language.
 String getPreferencesValue(PortletPreferences preferences, String key, String languageId, boolean useDefault)
          Returns the localized preferences value for the key in the language, optionally using the default language if no localization exists for the requested language.
 String[] getPreferencesValues(PortletPreferences preferences, String key, String languageId)
          Returns the localized preferences values for the key in the language.
 String[] getPreferencesValues(PortletPreferences preferences, String key, String languageId, boolean useDefault)
          Returns the localized preferences values for the key in the language, optionally using the default language if no localization exists for the requested language.
 String getSettingsValue(Settings settings, String key, String languageId)
          Returns the localized settings value for the key in the language.
 String getSettingsValue(Settings settings, String key, String languageId, boolean useDefault)
          Returns the localized settings value for the key in the language, optionally using the default language if no localization exists for the requested language.
 String[] getSettingsValues(Settings settings, String key, String languageId)
          Returns the localized settings values for the key in the language.
 String[] getSettingsValues(Settings settings, String key, String languageId, boolean useDefault)
          Returns the localized settings values for the key in the language, optionally using the default language if no localization exists for the requested language.
 String getXml(LocalizedValuesMap localizedValuesMap, String key)
           
 String removeLocalization(String xml, String key, String requestedLanguageId)
          Removes the localization for the language from the localizations XML.
 String removeLocalization(String xml, String key, String requestedLanguageId, boolean cdata)
          Removes the localization for the language from the localizations XML, optionally storing the localized strings as CDATA in the XML.
 String removeLocalization(String xml, String key, String requestedLanguageId, boolean cdata, boolean localized)
          Removes the localization for the language from the localizations XML, optionally storing the localized strings as CDATA in the XML.
 void setLocalizedPreferencesValues(PortletRequest portletRequest, PortletPreferences preferences, String parameter)
          Sets the localized preferences values for the parameter in the portlet request.
 void setPreferencesValue(PortletPreferences preferences, String key, String languageId, String value)
          Sets the localized preferences value for the key in the language.
 void setPreferencesValues(PortletPreferences preferences, String key, String languageId, String[] values)
          Sets the localized preferences values for the key in the language.
 String updateLocalization(Map<Locale,String> localizationMap, String xml, String key, String defaultLanguageId)
          Updates the localized string for all the available languages in the localizations XML for the map of locales and localized strings and changes the default language.
 String updateLocalization(String xml, String key, String value)
          Updates the localized string for the system default language in the localizations XML.
 String updateLocalization(String xml, String key, String value, String requestedLanguageId)
          Updates the localized string for the language in the localizations XML.
 String updateLocalization(String xml, String key, String value, String requestedLanguageId, String defaultLanguageId)
          Updates the localized string for the language in the localizations XML and changes the default language.
 String updateLocalization(String xml, String key, String value, String requestedLanguageId, String defaultLanguageId, boolean cdata)
          Updates the localized string for the language in the localizations XML and changes the default language, optionally storing the localized strings as CDATA in the XML.
 String updateLocalization(String xml, String key, String value, String requestedLanguageId, String defaultLanguageId, boolean cdata, boolean localized)
          Updates the localized string for the language in the localizations XML and changes the default language, optionally storing the localized strings as CDATA in the XML.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalizationImpl

public LocalizationImpl()
Method Detail

deserialize

public Object deserialize(JSONObject jsonObject)
Description copied from interface: Localization
Deserializes the JSON object into a map of locales and localized strings.

Specified by:
deserialize in interface Localization
Parameters:
jsonObject - the JSON object
Returns:
the locales and localized strings

getAvailableLanguageIds

public String[] getAvailableLanguageIds(Document document)
Specified by:
getAvailableLanguageIds in interface Localization

getAvailableLanguageIds

public String[] getAvailableLanguageIds(String xml)
Description copied from interface: Localization
Returns the available locales from the localizations XML.

Specified by:
getAvailableLanguageIds in interface Localization
Parameters:
xml - the localizations XML
Returns:
the language IDs of the available locales

getDefaultImportLocale

public Locale getDefaultImportLocale(String className,
                                     long classPK,
                                     Locale contentDefaultLocale,
                                     Locale[] contentAvailableLocales)
Description copied from interface: Localization
Returns a valid default locale for importing a localized entity.

Specified by:
getDefaultImportLocale in interface Localization
Parameters:
className - the class name of the entity
classPK - the primary keys of the entity
contentDefaultLocale - the default Locale of the entity
contentAvailableLocales - the available locales of the entity
Returns:
the valid locale

getDefaultLanguageId

public String getDefaultLanguageId(Document document)
Specified by:
getDefaultLanguageId in interface Localization

getDefaultLanguageId

public String getDefaultLanguageId(Document document,
                                   Locale defaultLocale)
Specified by:
getDefaultLanguageId in interface Localization

getDefaultLanguageId

public String getDefaultLanguageId(String xml)
Description copied from interface: Localization
Returns the default locale from the localizations XML.

Specified by:
getDefaultLanguageId in interface Localization
Parameters:
xml - the localizations XML
Returns:
the language ID of the default locale, or the system default locale if the default locale cannot be retrieved from the XML

getDefaultLanguageId

public String getDefaultLanguageId(String xml,
                                   Locale defaultLocale)
Specified by:
getDefaultLanguageId in interface Localization

getLocalization

public String getLocalization(String xml,
                              String requestedLanguageId)
Description copied from interface: Localization
Returns the localized string from the localizations XML in the language. The default language is used if no localization exists for the requested language.

Specified by:
getLocalization in interface Localization
Parameters:
xml - the localizations XML
requestedLanguageId - the ID of the language
Returns:
the localized string

getLocalization

public String getLocalization(String xml,
                              String requestedLanguageId,
                              boolean useDefault)
Description copied from interface: Localization
Returns the localized string from the localizations XML in the language, optionally using the default language if no localization exists for the requested language.

Specified by:
getLocalization in interface Localization
Parameters:
xml - the localizations XML
requestedLanguageId - the ID of the language
useDefault - whether to use the default language if no localization exists for the requested language
Returns:
the localized string, or an empty string if useDefault is false and no localization exists for the requested language

getLocalization

public String getLocalization(String xml,
                              String requestedLanguageId,
                              boolean useDefault,
                              String defaultValue)
Description copied from interface: Localization
Returns the localized string from the localizations XML in the language, optionally using the default language if no localization exists for the requested language. If no localization exists, the default value is returned.

Specified by:
getLocalization in interface Localization
Parameters:
xml - the localizations XML
requestedLanguageId - the ID of the language
useDefault - whether to use the default language if no localization exists for the requested language
defaultValue - the value returned if no localization exists
Returns:
the localized string, or the defaultValue if useDefault is false and no localization exists for the requested language

getLocalizationMap

public Map<Locale,String> getLocalizationMap(Collection<Locale> locales,
                                             Locale defaultLocale,
                                             String key)
Description copied from interface: Localization
Returns a map of locales and localized strings for the key. If no localization exists for a locale or the localization matches the default locale, that locale is not included in the map.

Specified by:
getLocalizationMap in interface Localization
Parameters:
locales - the locales to be used in the map
defaultLocale - the default locale
key - the language key to be translated
Returns:
the locales and localized strings for the key

getLocalizationMap

public Map<Locale,String> getLocalizationMap(javax.servlet.http.HttpServletRequest request,
                                             String parameter)
Description copied from interface: Localization
Returns a map of locales and localized strings for the parameter in the request.

Specified by:
getLocalizationMap in interface Localization
Parameters:
request - the request
parameter - the prefix of the parameters containing the localized strings. Each localization is loaded from a parameter with this prefix, followed by an underscore, and the language ID.
Returns:
the locales and localized strings

getLocalizationMap

public Map<Locale,String> getLocalizationMap(PortletPreferences preferences,
                                             String preferenceName)
Description copied from interface: Localization
Returns a map of locales and localized strings for the preference in the preferences container.

Specified by:
getLocalizationMap in interface Localization
Parameters:
preferences - the preferences container
preferenceName - the prefix of the preference containing the localized strings. Each localization is loaded from a preference with this prefix, followed by an underscore, and the language ID.
Returns:
the locales and localized strings

getLocalizationMap

public Map<Locale,String> getLocalizationMap(PortletPreferences preferences,
                                             String preferenceName,
                                             String propertyName)
Description copied from interface: Localization
Returns a map of locales and localized strings for the preference in the preferences container. If no localization exists for the preference in the default locale, the value of the property is used as the localization for it.

Specified by:
getLocalizationMap in interface Localization
Parameters:
preferences - the preferences container
preferenceName - the prefix of the preference containing the localized strings. Each localization is loaded from a preference with this prefix, followed by an underscore, and the language ID.
propertyName - the name of the property whose value is used as the localization for the default locale, if no localization exists for it
Returns:
the locales and localized strings

getLocalizationMap

public Map<Locale,String> getLocalizationMap(PortletPreferences preferences,
                                             String preferenceName,
                                             String propertyName,
                                             String defaultPropertyValue,
                                             ClassLoader classLoader)
Specified by:
getLocalizationMap in interface Localization

getLocalizationMap

public Map<Locale,String> getLocalizationMap(PortletRequest portletRequest,
                                             String parameter)
Description copied from interface: Localization
Returns a map of locales and localized strings for the parameter in the portlet request.

Specified by:
getLocalizationMap in interface Localization
Parameters:
portletRequest - the portlet request
parameter - the prefix of the parameters containing the localized strings. Each localization is loaded from a parameter with this prefix, followed by an underscore, and the language ID.
Returns:
the locales and localized strings

getLocalizationMap

public Map<Locale,String> getLocalizationMap(PortletRequest portletRequest,
                                             String parameter,
                                             Map<Locale,String> defaultValues)
Specified by:
getLocalizationMap in interface Localization

getLocalizationMap

public Map<Locale,String> getLocalizationMap(String xml)
Description copied from interface: Localization
Returns a map of locales and localized strings from the localizations XML.

Specified by:
getLocalizationMap in interface Localization
Parameters:
xml - the localizations XML
Returns:
the locales and localized strings

getLocalizationMap

public Map<Locale,String> getLocalizationMap(String xml,
                                             boolean useDefault)
Specified by:
getLocalizationMap in interface Localization

getLocalizationMap

public Map<Locale,String> getLocalizationMap(String bundleName,
                                             ClassLoader classLoader,
                                             String key,
                                             boolean includeBetaLocales)
Specified by:
getLocalizationMap in interface Localization

getLocalizationMap

public Map<Locale,String> getLocalizationMap(String[] languageIds,
                                             String[] values)
Description copied from interface: Localization
Returns a map of locales and localized strings for the given languageIds and values.

Specified by:
getLocalizationMap in interface Localization
Parameters:
languageIds - the languageIds of the localized Strings
values - the localized strings for the different languageId
Returns:
the map of locales and values for the given parameters

getLocalizationXmlFromPreferences

public String getLocalizationXmlFromPreferences(PortletPreferences preferences,
                                                PortletRequest portletRequest,
                                                String parameter)
Description copied from interface: Localization
Returns the localizations XML for the parameter from the portlet request, attempting to get data from the preferences container if it is not available in the portlet request.

Specified by:
getLocalizationXmlFromPreferences in interface Localization
Parameters:
preferences - the preferences container
portletRequest - the portlet request
parameter - the prefix of the parameters containing the localized strings. Each localization is loaded from a parameter with this prefix, followed by an underscore, and the language ID.
Returns:
the locales and localized strings

getLocalizationXmlFromPreferences

public String getLocalizationXmlFromPreferences(PortletPreferences preferences,
                                                PortletRequest portletRequest,
                                                String parameter,
                                                String defaultValue)
Description copied from interface: Localization
Returns the localizations XML for the parameter from the portlet request, attempting to get data from the preferences container if it is not available in the portlet request. If no localization exists in the default locale, the default value is used as the localization for it.

Specified by:
getLocalizationXmlFromPreferences in interface Localization
Parameters:
preferences - the preferences container
portletRequest - the portlet request
parameter - the prefix of the parameters containing the localized strings. Each localization is loaded from a parameter with this prefix, followed by an underscore, and the language ID.
defaultValue - the value used as the localization for the default locale, if no localization exists for it
Returns:
the locales and localized strings

getLocalizationXmlFromPreferences

public String getLocalizationXmlFromPreferences(PortletPreferences preferences,
                                                PortletRequest portletRequest,
                                                String parameter,
                                                String prefix,
                                                String defaultValue)
Description copied from interface: Localization
Returns the localizations XML for the prefixed parameter from the portlet request, attempting to get data from the preferences container if it is not available in the portlet request. If no localization exists for the the default locale, the default value is used as the localization for it.

Specified by:
getLocalizationXmlFromPreferences in interface Localization
Parameters:
preferences - the preferences container
portletRequest - the portlet request
parameter - the prefix of the parameters containing the localized strings. Each localization is loaded from a parameter with this prefix, followed by an underscore, and the language ID.
prefix - the value used in the request to prefix the parameter name
defaultValue - the value used as the localization for the default locale, if no localization exists for it
Returns:
the locales and localized strings, or the defaultValue if no localization exists

getLocalizedName

public String getLocalizedName(String name,
                               String languageId)
Description copied from interface: Localization
Returns the localized name in the language. The localized name is the name, followed by an underscore, and the language ID.

Specified by:
getLocalizedName in interface Localization
Parameters:
name - the name to be localized
languageId - the ID of the language
Returns:
the localized name for the language

getLocalizedParameter

@Deprecated
public Map<Locale,String> getLocalizedParameter(PortletRequest portletRequest,
                                                           String parameter)
Deprecated. As of 7.0.0

Specified by:
getLocalizedParameter in interface Localization

getMap

public Map<Locale,String> getMap(LocalizedValuesMap localizedValuesMap)
Specified by:
getMap in interface Localization

getPreferencesKey

@Deprecated
public String getPreferencesKey(String key,
                                           String languageId)
Deprecated. As of 7.0.0

Description copied from interface: Localization
Returns the localized preferences key in the language. Generally this is just the preferences key, followed by an underscore, and the language ID.

Specified by:
getPreferencesKey in interface Localization
Parameters:
key - the preferences key
languageId - the ID of the language
Returns:
the localized preferences key

getPreferencesValue

public String getPreferencesValue(PortletPreferences preferences,
                                  String key,
                                  String languageId)
Description copied from interface: Localization
Returns the localized preferences value for the key in the language. The default language is used if no localization exists for the requested language.

Specified by:
getPreferencesValue in interface Localization
Parameters:
preferences - the preferences container
key - the preferences key
languageId - the ID of the language
Returns:
the localized preferences value

getPreferencesValue

public String getPreferencesValue(PortletPreferences preferences,
                                  String key,
                                  String languageId,
                                  boolean useDefault)
Description copied from interface: Localization
Returns the localized preferences value for the key in the language, optionally using the default language if no localization exists for the requested language.

Specified by:
getPreferencesValue in interface Localization
Parameters:
preferences - the preferences container
key - the preferences key
languageId - the ID of the language
useDefault - whether to use the default language if no localization exists for the requested language
Returns:
the localized preferences value, or an empty string if useDefault is false and no localization exists for the requested language

getPreferencesValues

public String[] getPreferencesValues(PortletPreferences preferences,
                                     String key,
                                     String languageId)
Description copied from interface: Localization
Returns the localized preferences values for the key in the language. The default language is used if no localization exists for the requested language.

Specified by:
getPreferencesValues in interface Localization
Parameters:
preferences - the preferences container
key - the preferences key
languageId - the ID of the language
Returns:
the localized preferences values

getPreferencesValues

public String[] getPreferencesValues(PortletPreferences preferences,
                                     String key,
                                     String languageId,
                                     boolean useDefault)
Description copied from interface: Localization
Returns the localized preferences values for the key in the language, optionally using the default language if no localization exists for the requested language.

Specified by:
getPreferencesValues in interface Localization
Parameters:
preferences - the preferences container
key - the preferences key
languageId - the ID of the language
useDefault - whether to use the default language if no localization exists for the requested language
Returns:
the localized preferences values, or an empty string if useDefault is false and no localization exists for the requested language

getSettingsValue

public String getSettingsValue(Settings settings,
                               String key,
                               String languageId)
Description copied from interface: Localization
Returns the localized settings value for the key in the language. The default language is used if no localization exists for the requested language.

Specified by:
getSettingsValue in interface Localization
Parameters:
settings - the settings
key - the settings key
languageId - the ID of the language
Returns:
the localized settings value

getSettingsValue

public String getSettingsValue(Settings settings,
                               String key,
                               String languageId,
                               boolean useDefault)
Description copied from interface: Localization
Returns the localized settings value for the key in the language, optionally using the default language if no localization exists for the requested language.

Specified by:
getSettingsValue in interface Localization
Parameters:
settings - the settings
key - the settings key
languageId - the ID of the language
useDefault - whether to use the default language if no localization exists for the requested language
Returns:
the localized settings value. If useDefault is false and no localization exists for the requested language, an empty string is returned.

getSettingsValues

public String[] getSettingsValues(Settings settings,
                                  String key,
                                  String languageId)
Description copied from interface: Localization
Returns the localized settings values for the key in the language. The default language is used if no localization exists for the requested language.

Specified by:
getSettingsValues in interface Localization
Parameters:
settings - the settings
key - the settings key
languageId - the ID of the language
Returns:
the localized settings values

getSettingsValues

public String[] getSettingsValues(Settings settings,
                                  String key,
                                  String languageId,
                                  boolean useDefault)
Description copied from interface: Localization
Returns the localized settings values for the key in the language, optionally using the default language if no localization exists for the requested language.

Specified by:
getSettingsValues in interface Localization
Parameters:
settings - the settings
key - the settings key
languageId - the ID of the language
useDefault - whether to use the default language if no localization exists for the requested language
Returns:
the localized settings values. If useDefault is false and no localization exists for the requested language, an empty array is returned.

getXml

public String getXml(LocalizedValuesMap localizedValuesMap,
                     String key)
Specified by:
getXml in interface Localization

removeLocalization

public String removeLocalization(String xml,
                                 String key,
                                 String requestedLanguageId)
Description copied from interface: Localization
Removes the localization for the language from the localizations XML. The localized strings are stored as characters in the XML.

Specified by:
removeLocalization in interface Localization
Parameters:
xml - the localizations XML
key - the name of the localized string, such as "Title"
requestedLanguageId - the ID of the language
Returns:
the localizations XML with the language removed

removeLocalization

public String removeLocalization(String xml,
                                 String key,
                                 String requestedLanguageId,
                                 boolean cdata)
Description copied from interface: Localization
Removes the localization for the language from the localizations XML, optionally storing the localized strings as CDATA in the XML.

Specified by:
removeLocalization in interface Localization
Parameters:
xml - the localizations XML
key - the name of the localized string, such as "Title"
requestedLanguageId - the ID of the language
cdata - whether to store localized strings as CDATA in the XML
Returns:
the localizations XML with the language removed

removeLocalization

public String removeLocalization(String xml,
                                 String key,
                                 String requestedLanguageId,
                                 boolean cdata,
                                 boolean localized)
Description copied from interface: Localization
Removes the localization for the language from the localizations XML, optionally storing the localized strings as CDATA in the XML.

Specified by:
removeLocalization in interface Localization
Parameters:
xml - the localizations XML
key - the name of the localized string, such as "Title"
requestedLanguageId - the ID of the language
cdata - whether to store localized strings as CDATA in the XML
localized - whether there is a localized field
Returns:
the localizations XML with the language removed

setLocalizedPreferencesValues

public void setLocalizedPreferencesValues(PortletRequest portletRequest,
                                          PortletPreferences preferences,
                                          String parameter)
                                   throws Exception
Description copied from interface: Localization
Sets the localized preferences values for the parameter in the portlet request.

Specified by:
setLocalizedPreferencesValues in interface Localization
Parameters:
portletRequest - the portlet request
preferences - the preferences container
parameter - the prefix of the parameters containing the localized strings. Each localization is loaded from a parameter with this prefix, followed by an underscore, and the language ID.
Throws:
Exception - if an exception occurred

setPreferencesValue

public void setPreferencesValue(PortletPreferences preferences,
                                String key,
                                String languageId,
                                String value)
                         throws Exception
Description copied from interface: Localization
Sets the localized preferences value for the key in the language.

Specified by:
setPreferencesValue in interface Localization
Parameters:
preferences - the preferences container
key - the preferences key
languageId - the ID of the language
value - the localized value
Throws:
Exception - if an exception occurred

setPreferencesValues

public void setPreferencesValues(PortletPreferences preferences,
                                 String key,
                                 String languageId,
                                 String[] values)
                          throws Exception
Description copied from interface: Localization
Sets the localized preferences values for the key in the language.

Specified by:
setPreferencesValues in interface Localization
Parameters:
preferences - the preferences container
key - the preferences key
languageId - the ID of the language
values - the localized values
Throws:
Exception - if an exception occurred

updateLocalization

public String updateLocalization(Map<Locale,String> localizationMap,
                                 String xml,
                                 String key,
                                 String defaultLanguageId)
Description copied from interface: Localization
Updates the localized string for all the available languages in the localizations XML for the map of locales and localized strings and changes the default language. The localized strings are stored as characters in the XML.

Specified by:
updateLocalization in interface Localization
Parameters:
localizationMap - the locales and localized strings
xml - the localizations XML
key - the name of the localized string, such as "Title"
defaultLanguageId - the ID of the default language
Returns:
the updated localizations XML

updateLocalization

public String updateLocalization(String xml,
                                 String key,
                                 String value)
Description copied from interface: Localization
Updates the localized string for the system default language in the localizations XML. The localized strings are stored as characters in the XML.

Specified by:
updateLocalization in interface Localization
Parameters:
xml - the localizations XML
key - the name of the localized string, such as "Title"
value - the localized string
Returns:
the updated localizations XML

updateLocalization

public String updateLocalization(String xml,
                                 String key,
                                 String value,
                                 String requestedLanguageId)
Description copied from interface: Localization
Updates the localized string for the language in the localizations XML. The localized strings are stored as characters in the XML.

Specified by:
updateLocalization in interface Localization
Parameters:
xml - the localizations XML
key - the name of the localized string, such as "Title"
value - the localized string
requestedLanguageId - the ID of the language
Returns:
the updated localizations XML

updateLocalization

public String updateLocalization(String xml,
                                 String key,
                                 String value,
                                 String requestedLanguageId,
                                 String defaultLanguageId)
Description copied from interface: Localization
Updates the localized string for the language in the localizations XML and changes the default language. The localized strings are stored as characters in the XML.

Specified by:
updateLocalization in interface Localization
Parameters:
xml - the localizations XML
key - the name of the localized string, such as "Title"
value - the localized string
requestedLanguageId - the ID of the language
defaultLanguageId - the ID of the default language
Returns:
the updated localizations XML

updateLocalization

public String updateLocalization(String xml,
                                 String key,
                                 String value,
                                 String requestedLanguageId,
                                 String defaultLanguageId,
                                 boolean cdata)
Description copied from interface: Localization
Updates the localized string for the language in the localizations XML and changes the default language, optionally storing the localized strings as CDATA in the XML.

Specified by:
updateLocalization in interface Localization
Parameters:
xml - the localizations XML
key - the name of the localized string, such as "Title"
value - the localized string
requestedLanguageId - the ID of the language
defaultLanguageId - the ID of the default language
cdata - whether to store localized strings as CDATA in the XML
Returns:
the updated localizations XML

updateLocalization

public String updateLocalization(String xml,
                                 String key,
                                 String value,
                                 String requestedLanguageId,
                                 String defaultLanguageId,
                                 boolean cdata,
                                 boolean localized)
Description copied from interface: Localization
Updates the localized string for the language in the localizations XML and changes the default language, optionally storing the localized strings as CDATA in the XML.

Specified by:
updateLocalization in interface Localization
Parameters:
xml - the localizations XML
key - the name of the localized string, such as "Title"
value - the localized string
requestedLanguageId - the ID of the language
defaultLanguageId - the ID of the default language
cdata - whether to store localized strings as CDATA in the XML
localized - whether there is a localized field
Returns:
the updated localizations XML

Liferay 7.0-ce-b4