package com.adealink.weparty.locale

import com.adealink.frame.locale.language.config.ILanguageConfig
import com.adealink.frame.locale.language.data.Language
import com.adealink.weparty.storage.AppPref
import java.util.Locale

class LanguageConfig : ILanguageConfig {

    override val supportLocals = listOf(
        Language.ID,
        Language.EN,
        Language.ZH, //中文放最后
    )

    override fun getLanguageLocale(): Locale {
        return Locale(AppPref.languageCode, AppPref.languageCountry, AppPref.languageVariant)
    }

    override fun saveLanguageLocale(locale: Locale?) {
        AppPref.languageCode = locale?.language ?: ""
        AppPref.languageCountry = locale?.country ?: ""
        AppPref.languageVariant = locale?.variant ?: ""
    }
}