LocalePreferences

Provides friendly APIs to get the user's locale preferences. The data can refer to external/cldr/common/main/en.xml.

Types

Link copied to clipboard
open class CalendarType
APIs to get the user's preference of Calendar.
Link copied to clipboard
open class FirstDayOfWeek
APIs to get the user's preference of the first day of week.
Link copied to clipboard
open class HourCycle
APIs to get the user's preference of the hour cycle.
Link copied to clipboard
open class TemperatureUnit
APIs to get the user's preference of temperature unit.

Functions

Link copied to clipboard
@NonNull
open fun getCalendarType(): @NonNull String
Return the user's preference of the calendar type which is from getDefault.
@NonNull
open fun getCalendarType(resolved: Boolean): @NonNull String
Return the user's preference of the calendar type which is from getDefault, e.g.
@NonNull
open fun getCalendarType(@NonNull locale: @NonNull Locale): @NonNull String
Return the calendar type of the inputted Locale.
@NonNull
open fun getCalendarType(@NonNull locale: @NonNull Locale, resolved: Boolean): @NonNull String
Return the calendar type of the inputted Locale, e.g.
Link copied to clipboard
@NonNull
open fun getFirstDayOfWeek(): @NonNull String
Return the user's preference of the first day of week which is from getDefault.
@NonNull
open fun getFirstDayOfWeek(resolved: Boolean): @NonNull String
Return the user's preference of the first day of week which is from getDefault, e.g.
@NonNull
open fun getFirstDayOfWeek(@NonNull locale: @NonNull Locale): @NonNull String
Return the first day of week of the inputted Locale.
@NonNull
open fun getFirstDayOfWeek(@NonNull locale: @NonNull Locale, resolved: Boolean): @NonNull String
Return the first day of week of the inputted Locale, e.g.
Link copied to clipboard
@NonNull
open fun getHourCycle(): @NonNull String
Return the user's preference of the hour cycle which is from getDefault.
@NonNull
open fun getHourCycle(resolved: Boolean): @NonNull String
Return the user's preference of the hour cycle which is from getDefault, e.g.
@NonNull
open fun getHourCycle(@NonNull locale: @NonNull Locale): @NonNull String
@NonNull
open fun getHourCycle(@NonNull locale: @NonNull Locale, resolved: Boolean): @NonNull String
Return the hour cycle setting of the inputted Locale.
Link copied to clipboard
@NonNull
open fun getTemperatureUnit(): @NonNull String
Return the user's preference of the temperature unit which is from getDefault.
@NonNull
open fun getTemperatureUnit(resolved: Boolean): @NonNull String
Return the user's preference of the temperature unit which is from getDefault, e.g.
@NonNull
open fun getTemperatureUnit(@NonNull locale: @NonNull Locale): @NonNull String
@NonNull
open fun getTemperatureUnit(@NonNull locale: @NonNull Locale, resolved: Boolean): @NonNull String
Return the temperature unit of the inputted Locale.