public final class

DefaultLocalizationListener

extends Object
implements LocalizationListener
java.lang.Object
   ↳ com.pspdfkit.listeners.DefaultLocalizationListener

Class Overview

Default implementation of a LocalizationListener which just calls through to default Android localization methods in android.content.res.Resources class and picks up strings from XML files.

Summary

Public Constructors
DefaultLocalizationListener()
Public Methods
String getLocalizedQuantityString(Context context, int res, Locale locale, View view, int quantity, Object... formatArgs)
Called when a quantity (pluralizable) string needs to be localized and has to return a localized string.
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.
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.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pspdfkit.listeners.LocalizationListener

Public Constructors

public DefaultLocalizationListener ()

Public Methods

public String getLocalizedQuantityString (Context context, int res, Locale locale, 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.
res Resource id of the string requested. See strings.xml file of PSPDFKit for all possible strings.
locale 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 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 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.