All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.freya022.botcommands.api.localization.LocalizationService.kt Maven / Gradle / Ivy

Go to download

A Kotlin-first (and Java) framework that makes creating Discord bots a piece of cake, using the JDA library.

There is a newer version: 3.0.0-alpha.18
Show newest version
package io.github.freya022.botcommands.api.localization

import io.github.freya022.botcommands.api.core.service.annotations.InterfacedService
import io.github.freya022.botcommands.api.localization.arguments.factories.FormattableArgumentFactory
import io.github.freya022.botcommands.api.localization.providers.LocalizationMapProvider
import io.github.freya022.botcommands.api.localization.readers.LocalizationMapReader
import org.jetbrains.annotations.UnmodifiableView
import java.util.*

/**
 * Service to retrieve [Localization] instances with the requested name and locale.
 */
@InterfacedService(acceptMultiple = false)
interface LocalizationService {
    /**
     * Gets the localization instance for the specified bundle name and locale.
     *
     * This cycles through all the available [LocalizationMap providers][LocalizationMapProvider]
     * until one returns a valid localization bundle.
     *
     * @param baseName The name of the bundle
     * @param locale   The locale of the bundle
     *
     * @return The localization instance for this bundle
     */
    fun getInstance(baseName: String, locale: Locale): Localization?

    /**
     * Invalidates all the localization bundles with the specified base name.
     *
     * @param baseName The base name of the bundles to invalidate
     */
    fun invalidateLocalization(baseName: String)

    /**
     * Invalidates the localization bundles with the specified base name and locale.
     *
     * @param baseName The base name of the bundles to invalidate
     * @param locale   The locale of the bundle to invalidate
     */
    fun invalidateLocalization(baseName: String, locale: Locale)

    /**
     * Returns an unmodifiable view of [LocalizationMap providers][LocalizationMapProvider].
     */
    fun getMappingProviders(): @UnmodifiableView Collection

    /**
     * Returns an unmodifiable view of [LocalizationMap readers][LocalizationMapReader].
     */
    fun getMappingReaders(): @UnmodifiableView Collection

    /**
     * Returns an unmodifiable view of [FormattableArgument factories][FormattableArgumentFactory].
     */
    fun getFormattableArgumentFactories(): @UnmodifiableView Collection
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy