Package com.pspdfkit.listeners
Class DefaultLocalizationListener
-
- All Implemented Interfaces:
-
com.pspdfkit.listeners.LocalizationListener
public final class DefaultLocalizationListener implements LocalizationListener
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.
-
-
Constructor Summary
Constructors Constructor Description DefaultLocalizationListener()
-
Method Summary
Modifier and Type Method Description String
getLocalizedString(@NonNull() Context context, @StringRes() int stringId, @NonNull() Locale currentLocale, @Nullable() View view)
Called when a string needs to be localized and has to return a localized string. String
getLocalizedString(@NonNull() Context context, @StringRes() int stringId, @NonNull() Locale currentLocale, @Nullable() View view, Array<Object> formatArgs)
Called when a string needs to be localized and has to return a localized string. String
getLocalizedQuantityString(@NonNull() Context context, @PluralsRes() int res, @NonNull() Locale locale, @Nullable() View view, int quantity, Array<Object> formatArgs)
Called when a quantity (pluralizable) string needs to be localized and has to return a localized string. -
-
Method Detail
-
getLocalizedString
@NonNull() String getLocalizedString(@NonNull() Context context, @StringRes() int stringId, @NonNull() Locale currentLocale, @Nullable() View view)
Called when a string needs to be localized and has to return a localized string. Default implementation calls through to getString.
- Parameters:
context
- Context.stringId
- Resource id of the string requested.currentLocale
- Locale for which the string is requested for.view
- View that requested the string if applicable.- Returns:
Localized string to be displayed.
-
getLocalizedString
@NonNull() String getLocalizedString(@NonNull() Context context, @StringRes() int stringId, @NonNull() Locale currentLocale, @Nullable() View view, Array<Object> formatArgs)
Called when a string needs to be localized and has to return a localized string. Default implementation calls through to getString.
- Parameters:
context
- Context.stringId
- Resource id of the string requested.currentLocale
- Locale for which the string is requested for.view
- View that requested the string if applicable.formatArgs
- Formatting arguments that should be applied to the localized string.- Returns:
Localized string to be displayed.
-
getLocalizedQuantityString
@NonNull() String getLocalizedQuantityString(@NonNull() Context context, @PluralsRes() int res, @NonNull() Locale locale, @Nullable() View view, int quantity, Array<Object> formatArgs)
Called when a quantity (pluralizable) string needs to be localized and has to return a localized string. Default implementation calls through to getQuantityString.
- Parameters:
context
- Context.view
- View that requested the string if applicable.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.
-
-
-
-