public interface

LocalizationListener

com.pspdfkit.listeners.LocalizationListener
Known Indirect Subclasses

Class Overview

Listener that allows SDK UI strings to be localized programmatically. Localization callbacks will be called on the main thread every time a string is needed so the callbacks MUST be fast and responsive.

Summary

Public Methods
abstract String getLocalizedQuantityString(Context context, int stringId, Locale currentLocale, View view, int quantity, Object... formatArgs)
Called when a quantity (pluralizable) string needs to be localized and has to return a localized string.
abstract String getLocalizedString(Context context, int stringId, Locale currentLocale, View view, Object... formatArgs)
Called when a string needs to be localized and has to return a localized string.
abstract String getLocalizedString(Context context, int stringId, Locale currentLocale, View view)
Called when a string needs to be localized and has to return a localized string.

Public Methods

public abstract String getLocalizedQuantityString (Context context, int stringId, Locale currentLocale, View view, int quantity, Object... formatArgs)

Called when a quantity (pluralizable) string needs to be localized and has to return a localized string. Default implementation calls through to android.content.res.Resources#getQuantityString(int, int, Object...).

Parameters
context Context.
stringId Resource id of the string requested. See strings.xml file of PSPDFKit for all possible strings.
currentLocale Locale for which the string is requested for.
view View that requested the string if applicable. May be null.
quantity Quantity to be used to choose a proper pluralizable string.
formatArgs Formatting arguments that should be applied to the localized string.
Returns
  • Localized string to be displayed.

public abstract String getLocalizedString (Context context, int stringId, Locale currentLocale, View view, Object... formatArgs)

Called when a string needs to be localized and has to return a localized string. Default implementation calls through to android.content.res.Resources#getString(int, Object...).

Parameters
context Context.
stringId Resource id of the string requested. See strings.xml file of PSPDFKit for all possible strings.
currentLocale Locale for which the string is requested for.
view View that requested the string if applicable. May be null.
formatArgs Formatting arguments that should be applied to the localized string.
Returns
  • Localized string to be displayed.

public abstract String getLocalizedString (Context context, int stringId, Locale currentLocale, View view)

Called when a string needs to be localized and has to return a localized string. Default implementation calls through to getString(int).

Parameters
context Context.
stringId Resource id of the string requested. See strings.xml file of PSPDFKit for all possible strings.
currentLocale Locale for which the string is requested for.
view View that requested the string if applicable. May be null.
Returns
  • Localized string to be displayed.