Package com.pspdfkit.listeners
Interface LocalizationListener
-
- All Implemented Interfaces:
public interface LocalizationListener
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.
-
-
Method Summary
Modifier and Type Method Description abstract 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. abstract 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. abstract String
getLocalizedQuantityString(@NonNull() Context context, @PluralsRes() int stringId, @NonNull() Locale currentLocale, @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() abstract 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() abstract 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() abstract String getLocalizedQuantityString(@NonNull() Context context, @PluralsRes() int stringId, @NonNull() Locale currentLocale, @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.stringId
- Resource id of the string requested.currentLocale
- Locale for which the string is requested for.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.
-
-
-
-