Class I18NActivityProcessor
java.lang.Object
org.exoplatform.social.core.processor.I18NActivityProcessor
Processes any i18n on activity to a dynamic new activity with the i18n title.
How to I18N-ize an activity:
How to I18N-ize an activity:
- Set titleId to indicate it is an I18N activity. titleId is used to map with a specific message bundle key via configuration.
-
If that resource bundle message is a compound resource bundle message, provide templateParams. The argument number will
be counted as it appears on the map.
For example:
templateParams = {"key1": "value1", "key2": "value2"} => message bundle arguments = ["value1", "value2"]. Note: To reserve the order of elements, LinkedHashMap must be used to create templateParams. - Create a resource bundle file and this file name is called "resourceBundleKeyFile" for configuration later.
-
Register the resource bundle file with
BaseResourceBundlePlugintoResourceBundleService. -
Register
ActivityResourceBundlePluginwith this service.
- Since:
- 1.2.8
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionI18NActivityProcessor(org.exoplatform.social.common.xmlprocessor.XMLProcessor xmlProcessor) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddActivityResourceBundlePlugin(ActivityResourceBundlePlugin activityResourceBundlePlugin) Registers an activity resource bundle plugin.org.exoplatform.social.core.activity.model.ExoSocialActivityprocess(org.exoplatform.social.core.activity.model.ExoSocialActivity i18nActivity, Locale selectedLocale) Processes the I18N activity which means that activity.getTitleId() != null.org.exoplatform.social.core.activity.model.ExoSocialActivityprocessKeys(org.exoplatform.social.core.activity.model.ExoSocialActivity i18nActivity, Locale selectedLocale) Processes the I18N activity which means that activity.getTitleId() != null.voidremoveActivityResourceBundlePlugin(ActivityResourceBundlePlugin activityResourceBundlePlugin) Unregisters an existing registered resource bundle plugin.voidsetResourceBundleService(org.exoplatform.services.resources.ResourceBundleService resourceBundleService) Sets the external resource bundle service.
-
Constructor Details
-
I18NActivityProcessor
public I18NActivityProcessor(org.exoplatform.social.common.xmlprocessor.XMLProcessor xmlProcessor) Constructor.
-
-
Method Details
-
addActivityResourceBundlePlugin
public void addActivityResourceBundlePlugin(ActivityResourceBundlePlugin activityResourceBundlePlugin) Registers an activity resource bundle plugin.- Parameters:
activityResourceBundlePlugin- The activity resource bundle plugin.- eXo level API
- Platform
-
removeActivityResourceBundlePlugin
public void removeActivityResourceBundlePlugin(ActivityResourceBundlePlugin activityResourceBundlePlugin) Unregisters an existing registered resource bundle plugin.- Parameters:
activityResourceBundlePlugin- The existing activity resource bundle plugin.- eXo level API
- Platform
-
process
public org.exoplatform.social.core.activity.model.ExoSocialActivity process(org.exoplatform.social.core.activity.model.ExoSocialActivity i18nActivity, Locale selectedLocale) Processes the I18N activity which means that activity.getTitleId() != null.- Parameters:
i18nActivity- The target activity to be processed.selectedLocale- The target locale that activity will be localized.- Returns:
- The activity which content has been localized.
- eXo level API
- Platform
-
processKeys
public org.exoplatform.social.core.activity.model.ExoSocialActivity processKeys(org.exoplatform.social.core.activity.model.ExoSocialActivity i18nActivity, Locale selectedLocale) Processes the I18N activity which means that activity.getTitleId() != null.- Parameters:
i18nActivity- The I18N activity.selectedLocale- The selected locale.- Returns:
- The new activity with I18N title.
- eXo level API
- Platform
-
setResourceBundleService
public void setResourceBundleService(org.exoplatform.services.resources.ResourceBundleService resourceBundleService) Sets the external resource bundle service.- Parameters:
resourceBundleService- The resource bundle service.- eXo level API
- Platform
-