android-components / mozilla.components.support.locale / LocaleManager

LocaleManager

object LocaleManager (source)

Helper for apps that want to change locale defined by the system.

Functions

Name Summary
getCurrentLocale fun getCurrentLocale(context: <ERROR CLASS>): Locale?
The latest stored locale saved by setNewLocale.
getSystemDefault fun getSystemDefault(): Locale?
Returns the locale set by the system
resetToSystemDefault fun resetToSystemDefault(context: <ERROR CLASS>): Unit
Change the current locale to the system defined one. As a result, getCurrentLocale will return null.
setNewLocale fun setNewLocale(context: <ERROR CLASS>, language: String): <ERROR CLASS>
Change the system defined locale to the indicated in the language parameter. This new language will be stored and will be the new current locale returned by getCurrentLocale.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.