|
Liferay 7.0-ce-b4 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.liferay.portal.util.LocalizationImpl
public class LocalizationImpl
| 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 |
|---|
public LocalizationImpl()
| Method Detail |
|---|
public Object deserialize(JSONObject jsonObject)
Localization
deserialize in interface LocalizationjsonObject - the JSON object
public String[] getAvailableLanguageIds(Document document)
getAvailableLanguageIds in interface Localizationpublic String[] getAvailableLanguageIds(String xml)
Localization
getAvailableLanguageIds in interface Localizationxml - the localizations XML
public Locale getDefaultImportLocale(String className,
long classPK,
Locale contentDefaultLocale,
Locale[] contentAvailableLocales)
Localization
getDefaultImportLocale in interface LocalizationclassName - the class name of the entityclassPK - the primary keys of the entitycontentDefaultLocale - the default Locale of the entitycontentAvailableLocales - the available locales of the entity
public String getDefaultLanguageId(Document document)
getDefaultLanguageId in interface Localization
public String getDefaultLanguageId(Document document,
Locale defaultLocale)
getDefaultLanguageId in interface Localizationpublic String getDefaultLanguageId(String xml)
Localization
getDefaultLanguageId in interface Localizationxml - the localizations XML
public String getDefaultLanguageId(String xml,
Locale defaultLocale)
getDefaultLanguageId in interface Localization
public String getLocalization(String xml,
String requestedLanguageId)
Localization
getLocalization in interface Localizationxml - the localizations XMLrequestedLanguageId - the ID of the language
public String getLocalization(String xml,
String requestedLanguageId,
boolean useDefault)
Localization
getLocalization in interface Localizationxml - the localizations XMLrequestedLanguageId - the ID of the languageuseDefault - whether to use the default language if no localization
exists for the requested language
useDefault is false and no localization
exists for the requested language
public String getLocalization(String xml,
String requestedLanguageId,
boolean useDefault,
String defaultValue)
Localization
getLocalization in interface Localizationxml - the localizations XMLrequestedLanguageId - the ID of the languageuseDefault - whether to use the default language if no localization
exists for the requested languagedefaultValue - the value returned if no localization exists
defaultValue if
useDefault is false and no localization
exists for the requested language
public Map<Locale,String> getLocalizationMap(Collection<Locale> locales,
Locale defaultLocale,
String key)
Localization
getLocalizationMap in interface Localizationlocales - the locales to be used in the mapdefaultLocale - the default localekey - the language key to be translated
public Map<Locale,String> getLocalizationMap(javax.servlet.http.HttpServletRequest request,
String parameter)
Localization
getLocalizationMap in interface Localizationrequest - the requestparameter - 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.
public Map<Locale,String> getLocalizationMap(PortletPreferences preferences,
String preferenceName)
Localization
getLocalizationMap in interface Localizationpreferences - the preferences containerpreferenceName - 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.
public Map<Locale,String> getLocalizationMap(PortletPreferences preferences,
String preferenceName,
String propertyName)
Localization
getLocalizationMap in interface Localizationpreferences - the preferences containerpreferenceName - 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
public Map<Locale,String> getLocalizationMap(PortletPreferences preferences,
String preferenceName,
String propertyName,
String defaultPropertyValue,
ClassLoader classLoader)
getLocalizationMap in interface Localization
public Map<Locale,String> getLocalizationMap(PortletRequest portletRequest,
String parameter)
Localization
getLocalizationMap in interface LocalizationportletRequest - the portlet requestparameter - 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.
public Map<Locale,String> getLocalizationMap(PortletRequest portletRequest,
String parameter,
Map<Locale,String> defaultValues)
getLocalizationMap in interface Localizationpublic Map<Locale,String> getLocalizationMap(String xml)
Localization
getLocalizationMap in interface Localizationxml - the localizations XML
public Map<Locale,String> getLocalizationMap(String xml,
boolean useDefault)
getLocalizationMap in interface Localization
public Map<Locale,String> getLocalizationMap(String bundleName,
ClassLoader classLoader,
String key,
boolean includeBetaLocales)
getLocalizationMap in interface Localization
public Map<Locale,String> getLocalizationMap(String[] languageIds,
String[] values)
Localization
getLocalizationMap in interface LocalizationlanguageIds - the languageIds of the localized Stringsvalues - the localized strings for the different languageId
public String getLocalizationXmlFromPreferences(PortletPreferences preferences,
PortletRequest portletRequest,
String parameter)
Localization
getLocalizationXmlFromPreferences in interface Localizationpreferences - the preferences containerportletRequest - the portlet requestparameter - 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.
public String getLocalizationXmlFromPreferences(PortletPreferences preferences,
PortletRequest portletRequest,
String parameter,
String defaultValue)
Localization
getLocalizationXmlFromPreferences in interface Localizationpreferences - the preferences containerportletRequest - the portlet requestparameter - 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
public String getLocalizationXmlFromPreferences(PortletPreferences preferences,
PortletRequest portletRequest,
String parameter,
String prefix,
String defaultValue)
Localization
getLocalizationXmlFromPreferences in interface Localizationpreferences - the preferences containerportletRequest - the portlet requestparameter - 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 namedefaultValue - the value used as the localization for the default
locale, if no localization exists for it
defaultValue if no localization exists
public String getLocalizedName(String name,
String languageId)
Localization
getLocalizedName in interface Localizationname - the name to be localizedlanguageId - the ID of the language
@Deprecated
public Map<Locale,String> getLocalizedParameter(PortletRequest portletRequest,
String parameter)
getLocalizedParameter in interface Localizationpublic Map<Locale,String> getMap(LocalizedValuesMap localizedValuesMap)
getMap in interface Localization
@Deprecated
public String getPreferencesKey(String key,
String languageId)
Localization
getPreferencesKey in interface Localizationkey - the preferences keylanguageId - the ID of the language
public String getPreferencesValue(PortletPreferences preferences,
String key,
String languageId)
Localization
getPreferencesValue in interface Localizationpreferences - the preferences containerkey - the preferences keylanguageId - the ID of the language
public String getPreferencesValue(PortletPreferences preferences,
String key,
String languageId,
boolean useDefault)
Localization
getPreferencesValue in interface Localizationpreferences - the preferences containerkey - the preferences keylanguageId - the ID of the languageuseDefault - whether to use the default language if no localization
exists for the requested language
useDefault is false and no localization
exists for the requested language
public String[] getPreferencesValues(PortletPreferences preferences,
String key,
String languageId)
Localization
getPreferencesValues in interface Localizationpreferences - the preferences containerkey - the preferences keylanguageId - the ID of the language
public String[] getPreferencesValues(PortletPreferences preferences,
String key,
String languageId,
boolean useDefault)
Localization
getPreferencesValues in interface Localizationpreferences - the preferences containerkey - the preferences keylanguageId - the ID of the languageuseDefault - whether to use the default language if no localization
exists for the requested language
useDefault is false and no localization
exists for the requested language
public String getSettingsValue(Settings settings,
String key,
String languageId)
Localization
getSettingsValue in interface Localizationsettings - the settingskey - the settings keylanguageId - the ID of the language
public String getSettingsValue(Settings settings,
String key,
String languageId,
boolean useDefault)
Localization
getSettingsValue in interface Localizationsettings - the settingskey - the settings keylanguageId - the ID of the languageuseDefault - whether to use the default language if no localization
exists for the requested language
useDefault is
false and no localization exists for the requested
language, an empty string is returned.
public String[] getSettingsValues(Settings settings,
String key,
String languageId)
Localization
getSettingsValues in interface Localizationsettings - the settingskey - the settings keylanguageId - the ID of the language
public String[] getSettingsValues(Settings settings,
String key,
String languageId,
boolean useDefault)
Localization
getSettingsValues in interface Localizationsettings - the settingskey - the settings keylanguageId - the ID of the languageuseDefault - whether to use the default language if no localization
exists for the requested language
useDefault is
false and no localization exists for the requested
language, an empty array is returned.
public String getXml(LocalizedValuesMap localizedValuesMap,
String key)
getXml in interface Localization
public String removeLocalization(String xml,
String key,
String requestedLanguageId)
Localization
removeLocalization in interface Localizationxml - the localizations XMLkey - the name of the localized string, such as "Title"requestedLanguageId - the ID of the language
public String removeLocalization(String xml,
String key,
String requestedLanguageId,
boolean cdata)
Localization
removeLocalization in interface Localizationxml - the localizations XMLkey - the name of the localized string, such as "Title"requestedLanguageId - the ID of the languagecdata - whether to store localized strings as CDATA in the XML
public String removeLocalization(String xml,
String key,
String requestedLanguageId,
boolean cdata,
boolean localized)
Localization
removeLocalization in interface Localizationxml - the localizations XMLkey - the name of the localized string, such as "Title"requestedLanguageId - the ID of the languagecdata - whether to store localized strings as CDATA in the XMLlocalized - whether there is a localized field
public void setLocalizedPreferencesValues(PortletRequest portletRequest,
PortletPreferences preferences,
String parameter)
throws Exception
Localization
setLocalizedPreferencesValues in interface LocalizationportletRequest - the portlet requestpreferences - the preferences containerparameter - 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.
Exception - if an exception occurred
public void setPreferencesValue(PortletPreferences preferences,
String key,
String languageId,
String value)
throws Exception
Localization
setPreferencesValue in interface Localizationpreferences - the preferences containerkey - the preferences keylanguageId - the ID of the languagevalue - the localized value
Exception - if an exception occurred
public void setPreferencesValues(PortletPreferences preferences,
String key,
String languageId,
String[] values)
throws Exception
Localization
setPreferencesValues in interface Localizationpreferences - the preferences containerkey - the preferences keylanguageId - the ID of the languagevalues - the localized values
Exception - if an exception occurred
public String updateLocalization(Map<Locale,String> localizationMap,
String xml,
String key,
String defaultLanguageId)
Localization
updateLocalization in interface LocalizationlocalizationMap - the locales and localized stringsxml - the localizations XMLkey - the name of the localized string, such as "Title"defaultLanguageId - the ID of the default language
public String updateLocalization(String xml,
String key,
String value)
Localization
updateLocalization in interface Localizationxml - the localizations XMLkey - the name of the localized string, such as "Title"value - the localized string
public String updateLocalization(String xml,
String key,
String value,
String requestedLanguageId)
Localization
updateLocalization in interface Localizationxml - the localizations XMLkey - the name of the localized string, such as "Title"value - the localized stringrequestedLanguageId - the ID of the language
public String updateLocalization(String xml,
String key,
String value,
String requestedLanguageId,
String defaultLanguageId)
Localization
updateLocalization in interface Localizationxml - the localizations XMLkey - the name of the localized string, such as "Title"value - the localized stringrequestedLanguageId - the ID of the languagedefaultLanguageId - the ID of the default language
public String updateLocalization(String xml,
String key,
String value,
String requestedLanguageId,
String defaultLanguageId,
boolean cdata)
Localization
updateLocalization in interface Localizationxml - the localizations XMLkey - the name of the localized string, such as "Title"value - the localized stringrequestedLanguageId - the ID of the languagedefaultLanguageId - the ID of the default languagecdata - whether to store localized strings as CDATA in the XML
public String updateLocalization(String xml,
String key,
String value,
String requestedLanguageId,
String defaultLanguageId,
boolean cdata,
boolean localized)
Localization
updateLocalization in interface Localizationxml - the localizations XMLkey - the name of the localized string, such as "Title"value - the localized stringrequestedLanguageId - the ID of the languagedefaultLanguageId - the ID of the default languagecdata - whether to store localized strings as CDATA in the XMLlocalized - whether there is a localized field
|
Liferay 7.0-ce-b4 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||