LocaleManagerCompat

Added in 1.9.0

class LocaleManagerCompat


Helper for accessing features in android.app.LocaleManager in a backwards compatible fashion.

Summary

Public functions

java-static LocaleListCompat

Returns application locales for the calling app as a LocaleListCompat.

java-static LocaleListCompat

Returns the current system locales, ignoring app-specific overrides.

Public functions

getApplicationLocales

Added in 1.11.0
@AnyThread
java-static fun getApplicationLocales(context: Context): LocaleListCompat

Returns application locales for the calling app as a LocaleListCompat. This API for non-androidx.appcompat.app.AppCompatDelegate context to easily get the per-app locale on the prior API 33 devices.

Returns a getEmptyLocaleList if no app-specific locales are set.

getSystemLocales

Added in 1.9.0
@AnyThread
java-static fun getSystemLocales(context: Context): LocaleListCompat

Returns the current system locales, ignoring app-specific overrides.

Note: Apps should generally access the user's locale preferences as indicated in their in-process android.os.LocaleLists. However, in case an app-specific locale is set, this method helps cater to rare use-cases which might require specifically knowing the system locale.