parent
7474b33a7e
commit
7abf6fd268
@ -1,36 +0,0 @@ |
|||||||
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) |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
Loading…
Reference in new issue