package net.pokeranalytics.android.util

import android.content.Context
import java.util.*



class LocaleUtils {

	companion object {

		/**
		 * Return the current locale
		 */
		fun getCurrentLocale(context: Context) : Locale {
			val defaultLocaleCode = Preferences.getString(Preferences.Keys.LOCALE_CODE, context)
			var locale = Locale.getDefault()
			if (defaultLocaleCode != null) {
				locale = Locale(defaultLocaleCode)
				Locale.setDefault(locale)
			}
			return locale
		}


		/**
		 *
		 */
		fun setCurrentLocale(context: Context, language: String) {
			Preferences.setString(Preferences.Keys.LOCALE_CODE, language, context)
		}


	}

}