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

com.freya02.botcommands.internal.utils.LocalizationUtils.kt Maven / Gradle / Ivy

package com.freya02.botcommands.internal.utils

import com.freya02.botcommands.api.localization.Localization
import com.freya02.botcommands.internal.BContextImpl
import java.util.*

internal object LocalizationUtils {
    fun getCommandRootLocalization(context: BContextImpl, path: String?): String? {
        val localesMap: Map> = context.applicationConfig.baseNameToLocalesMap
        for (baseName in localesMap.keys) {
            val localization = Localization.getInstance(baseName, Locale.ROOT)
            if (localization != null) {
                val template = localization[path]
                if (template != null) {
                    return template.localize()
                }
            }
        }
        return null
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy