package dev.fyloz.plannervio.core.service

import java.util.*

/**
 * A service for internationalization.
 */
interface II18nService {
    /**
     * The resource bundle used by this service.
     */
    val bundle: ResourceBundle

    /**
     * Gets a localized string in the resource bundle for a given key.
     *
     * @param key The key of the localized string.
     * @return The localized string for the given key.
     */
    fun getLocalizedString(key: II18nKey): String
}

/**
 * A key in an internationalization resource bundle.
 */
interface II18nKey {
    /**
     * The name of the key.
     */
    val keyName: String
}

/**
 * Creates a internationalization resource bundle key.
 *
 * @param keyName The name of the key in the resource bundle.
 *
 * @see II18nKey
 */
fun iI18nKeyFactory(
    keyName: String = "name"
): II18nKey {
    return object : II18nKey {
        override val keyName: String = keyName
    }
}
