Class DefaultLocalizationListener

    • Constructor Detail

      • DefaultLocalizationListener

        DefaultLocalizationListener()
    • 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.